June 25, 2007

Introducing the Thunar file manager

Author: Christopher Hever

Since its inception, the Xfce desktop environment has aimed to provide high functionality with only modest demands on system resources, with the overarching goal of leaving more facilities for the user to run applications. One of the significant changes in recent releases of Xfce 4 is the Thunar file manager, which replaces the original xffm. Thunar does a good deal to advance the goals of its parent project: it's fast and lean, especially by today's standards of hardware, yet it offers rich functionality. Like its namesake, Thunor, the Saxon god of thunder, Thunar is much smaller than "giants" like Konqueror and Nautilus, yet powerful in its own right. If you want some of the functionality afforded by the GUI file managers of the larger desktop environments, but with less overhead, Thunar may fit your needs.

Getting Thunar is fairly trivial, given that most recent distributions package Xfce 4. Once you have it, you can start it from within Xfce from the desktop or panel launchers, or from outside of Xfce by running the command Thunar -- an exception to the Unix lower-case convention.

If you run Thunar outside of Xfce, you may wish to set Xfce's configuration first by running xfce-mcs-manager, the Xfce settings daemon. In my case, for instance, the Xfce icon theme fails to load without the daemon, and the file management pane fills with the default dog-eared page icons, rather than more descriptive icons specific to file types.

A view of the current directory dominates the Thunar window (see Figure 1), and is surrounded by several other tools and navigational aids. Above the directory view is a line of tabs that point to the components of the most recently visited directory that is at or below the current directory. To the left is a side pane that can display either a handful of common shortcuts or a full tree view. Above is the familiar file manager menu, whose most commonly used functions are duplicated in a right-click context menu for files in the directory pane.

Thunar's interface is clean and uncomplicated, but you can customize it to get a comfortable configuration. The Thunar screenshot above differs from the default setup in that it removes hidden files from view, and displays a detailed list view, rather than the default icon view.

In addition to its simple screen layout, Thunar also boasts a set of keyboard shortcuts that appear next to menu items. Learning at least a few of these can help you be more efficient.

Custom Actions

One of Thunar's strengths is its flexible system of custom actions. Thunar includes user-defined functions for files and directories in the File and context menus according to appearance conditions, which allows presentation of custom actions according to context. Thunar provides several of these custom actions by default, but you can add your own. To create a custom action, go to Edit -> Configure custom actions, and press the small add icon. Thunar will present you with a dialog asking you to describe the custom action and the conditions under which it will appear.

In the image to the right, I describe the custom action for Java compiler action and add the command /home/hanumizzle/java-compile.sh %F, which invokes a small script I wrote in my user directory. It compiles all Java files given as arguments and notifies the user of any errors with a Zenity text info window. In the Appearance Conditions dialog (not shown), I specify the file pattern "*.java" so that the action applies only to Java source files.

To use the action, I change to a directory containing Java files and select them with Edit -> Select by Pattern, using the same pattern as above. I then right-click on my selection, using the new Compile Java Files action that appears in the context menu. Thunar replaces certain sequences in the command line with useful values; in this case, %F expands to a list of all selected files. A full list of these sequences appears directly in the custom action configuration dialog.

Interface tweaks

Some of Thunar's features are simpler, but still enjoyable. If you want to make only a single click to open a file, go to the Behavior tab in Edit -> File Manager Preferences. A slider controls how long the mouse can hover over a file before it is automatically selected. Another interesting feature in the Properties dialog for a file is the Emblems tab, which allows you to tag a file with icons that betoken things like "important," "shared," or "draft," for easy finding later. Some Thunar features are less obvious. The Icon View mode supports a set of simple mouse gestures invoked by holding down the middle mouse button -- emulated by holding down both left and right mouse buttons or clicking the mouse wheel, for those of us without Sun workstations -- and dragging up, down, left, or right to visit, respectively, the parent directory, reload current directory, visit last most recent directory (akin to Back button), and visit next most recent directory (akin to Forward button).

A little-known but highly useful feature of the directory view in Thunar, and indeed in other list, icon, or tree views in other Gtk applications, is the keystroke Ctrl-F, which launches a recursive search of the items in the view. This feature is particularly useful for quickly finding a filename in a directory containing many files.

Plugin enhancements

Thunar can also enhance its capabilities with plugins that can be found on its home page. These plugins are in varying stages of development, but two that work well with stable releases of Thunar are the archiver and media tags plugins, which are both straightforward configure-based installs. The archiver plugin adds Extract Here and Extract To functions to the File and context menus when the selected files are recognized as archive file types, such as zip and tar.gz, and a Create Archive function when other kinds of files are selected. If it finds multiple archivers, the plugin will prompt you to choose from them. The media tags plugin adds an Audio pane to the Properties dialog for sound files that furnishes metadata such as the running length and sample rate of a sound file, and allows you to read and edit its property tags.

Thunar is a robust file manager, user-friendly enough to please new users, while lightweight enough to please command-line enthusiasts. Though some of the plugins are a little raw, and it doesn't support a number of more advanced features offered by larger file managers like Konqueror, it performs well with most daily file management activities. Thunar makes a great addition to anyone's toolset, and the active development that surrounds the Xfce project ensures that its future will only be better.

Christopher Hever is a freshman computer science student. Among his interests are productivity-enhancing applications, text editors, programming languages, and Germanic mythology, to which he is indebted for this article.


  • Desktop Software
Click Here!