leah blogs

June 2005

13jun2005 · A file manager for discriminating hackers

Being a “poweruser” spending a lot of his time developing software, I heavily use the command-line, like most others do too. You could say that I spend at least a third of my time in front of some shell (and my Emacs runs in an external window, mind).

Therefore, I strive for efficiency on the command-line, but recently I found out how I would get the biggest slowdown when working with the shell: I’d just need to sit down at a computer that doesn’t have the GNU Midnight Commander installed.

As you may know, the Midnight Commander—or mc for short—is a Unix clone of the Norton Commander, but last time I saw it, Norton Commander was quite different to Midnight Commander. Still, they share the basic concept, the two-panel fileview.

In my opinion, a two-panel file manager is the most effective way to interactively work with files—move around in directories, select, copy and move files. I know that there are lots of people that use single-panel file, or even the horrible (despite all the good reasons there may be for it) spatial view, where each directory gets it’s own window. I don’t know about you, but to get my stuff done quickly, I far prefer using the keyboard over the mouse, and that is (almost) impossible when you have thousands of windows open, and need to “drag” files from here to there.

While those surely are easy to pickup and consistent with models whatever user interface developers came up, they are not the way to go—for me, at last.

Therefore, I have investigated into my use of mc, and came to the following conclusions:

  • I need a shell at my fingertips. mc makes this very easy, I can simply type my commands into the minibuffer and run them. Also, by pressing C-o I can quickly switch to a full-screen shell. Often, I even forget that I am in mc (I only notice that when I open a second mc in the shell emulation, and C-o will switch between both commanders…)! Also, the current filename can be copied to the minibuffer with a simple M-RET.

  • Two panes are good, one large one is even better. In mc, I can switch the size of the panel with M-t, it will get half-screen size or full-width then. I often work with both panels in full-width, because I see change time and permissions then, all at once. I then use TAB to switch between both of those panels. Seeing both at once isn’t necessary very often.

  • Easy selection is essential. mc makes this very easy, you either press INS (which is inconvenient on the iBook) or C-t to toggle marking the current file, and then can conveniently operate on them. By pressing C-x t, they are all inserted into the minibuffer. + will mark all files that match a shell glob.

  • File searches rock. Typing C-s, I can interactively search for filenames; this is especially useful for directories with lots of different files. Just too bad that it only can search for the beginning, and not for any file matching the search.

  • Virtual file systems are a joy. Being able to just enter archives or go to ftp sites by cding to their URL makes lots of things easier and faster than having to fire up tar in some temporary directory or remember ftp syntax (and no completion, yuck).

Still, I have some gripes with mc:

  • Give me a bigger shell. Sometimes, a one-line shell minibuffer is just too small, but a full-screen shell is too big. Why can’t I just have a 5 line pty?

  • Change sorting. Usually, I browse sorted by filename, but then, I need to find all the big files, or all the old files. mc should make it easier to change the sorting criteria with key strokes, so far, I need to F9 into the menu, down, Listing mode, Sort Order, Down until Size, OK. That’s just far too complicated! Emacs dired gets it a lot easier, for example, with s I can toggle between file name and date. Still no size, though.

  • Does it need to be a TUI? I know there is(was?) a Gnome Midnight Commander, but it didn’t work as the one for the shell. Especially when you work with folders of pictures, thumbnails would be just too useful. A text user interface is nice, but a graphical user interface, even if it’s just for displaying files, would be a good alternative too. Just make sure I don’t need a mouse to use it.

With all these points, I’ve decided to design my own file manager; however, it is unlikely I’ll get around implementing it in near future, there is just so much else to do, and mc doesn’t suck enough to make me really need it. :-)

My main idea is a four-panel file manager, on the top there are three columns of file panes: the first always displays the current working directory, and the other two can be assigned to any directory. On the bottom of the screen, there is a resizable terminal emulation (I think multi-gnome-terminal would be a good fit, for example), maybe five lines high by default. It is very important that that shell works good and behaves just like any other terminal emulator (some keystrokes aside).

Switching from the shell to the file panels must be very easy, the same is true for switching between the three file panels. Each panel must be maximizable and minimizable with a single keystroke; full-window shell, full-window file panel.

The file panels will have different views, say “file list”, “extended file list” (of most use when maximized), or “thumbnails” (of different sizes, too). Ideally, the user can program his own views. For example, you could make a view that internally calls find or locate, so you have a “virtual” folder that actually is a search result.

With a single keystroke, the user can swap, rotate and copy the file-panels; the usage remembers me a bit of the old HP RPN calculators that only had a very limited stack. The user can copy, move and delete files from any panel to any other, all with the keyboard.

On the bottom of the file list, there could be a (hidable) preview box, that could show more file details like file times, permissions, even the beginning of text files, or thumbnails. On the top, there could be a menu to go to often used directories.

When tapping RET on a file, it should use an extremely configurable mechanism to find out what to do with the file; on C-RET, it could provide a menu of common tasks for that kind of file. Integration with external editors (especially Emacs) would be very useful.

All these things also need to be accessible from the shell, possibly over some kind of IPC.

I know my idea probably sounds weird, but I think I’d be a very comfortable way of managing files—comfortable for powerusers, not necessarily newbies. If you’d like to implement it (or a subset of it), feel free to contact me, I can provide you a bit more information then.

NP: Aimee Mann—I Can’t Get My Head Around It

Copyright © 2004–2022