Sunflower – A small, highly configurable file manager

Sunrise

© Lead Image © Larisa Kravets, 123RF.com

© Lead Image © Larisa Kravets, 123RF.com

Author(s):

Sunflower is a highly configurable graphical file manager with two windows that implement an unusual concept by trying to integrate the command line with the file manager.

File managers on the popular desktop environments, such as Gnome, KDE, and Xfce, use a single window. Sunflower [1], however, continues in the vein of the classic Norton Commander – or its Linux counterpart, Midnight Commander – and uses two windows and a small row of buttons at the bottom for frequently used actions.

Sunflower, which is still actively developed, is lean and fast compared with the Gnome or KDE candidates. Implemented in Python, Sunflower has an interface that accepts plugins for new features. The control concept is different from its competitors, as well: The Sunflower file manager makes intensive use of the keyboard. In this respect, Sunflower is similar to Midnight Commander, although its design is quite different and extremely effective.

Commanding

The main window (Figure 1) shows the two panes between which you can move files, directories, or selections in either direction via drag and drop. Each panel manages multiple directories in tabs, which you can rearrange and move between panels. This principle is also used by Chrome, Chromium, and Firefox browsers and takes just a short familiarization period to become second nature.

Figure 1: Like its role model Norton Commander, Sunflower always shows two directories as juxtaposed windows.

Along the top of the window, the tabs show which directories are currently in view, along with information about free space on the storage medium. The path to the current directory can be used like bread crumbs, so you can quickly jump to a path lower down in the directory tree. Three buttons in the top-right corner of a tab open a terminal with the current directory, change to recently opened folders, or open a previously bookmarked folder.

At the bottom of the panels, three pairs of numbers provide the number of (sub)directories contained in a folder, the number of files, and the size of the directory contents. The first number always represents the current selection; the second summarizes the figures for all folders and files within that directory. At the bottom of the window, an input box lets you run shell commands in the context of the current folder.

Installation

Sunflower is rarely found in the package repositories, so you might have to build the file manager yourself from source code [2] or import the DEB and RPM packages [3] offered by the project manually using your package manager. Alternatively, the project page on Google Code points to an Ubuntu PPA repository [4] with the current version. On Arch Linux and Gentoo, AUR or Portage simplify the install.

The option of opening a terminal with the currently viewed directory is very useful for experienced Linux users in particular (Figure 2). Alternatively, the keyboard shortcut Ctrl+Z opens the currently active folder in the terminal and Ctrl+D closes the terminal window again; pressing Ctrl+W closes the entire tab – whether it includes a terminal or the listing for a directory.

Figure 2: A mouse click or keystroke lets you open the currently active directory in a terminal window.

Sunflower displays files and directories with their most important information, such as file permissions, the last change date, and size, making it easy to use this information to sort files by column. For example, if you always want to see the most recently modified files at the top, click on the date field; the same applies to file size or file type.

Sunflower saves its current state and the directories displayed in each panel. Because of this, the file manager can restore all open tabs in the form of a session, even after you quit or restart the system. However, Sunflower is not limited to just the current status. If the Sessions plugin is enabled in Edit | Preferences | Plugins, you can store application states in Edit | Preferences | Sessions. (After clicking a plugin's checkbox to activate it, you must click Save then leave and restart Sunflower to enable it.)

Keyboard Shortcuts

If you often work with Norton Commander or one of its heirs, you will probably use hot keys for many actions; accessing a desired function via menus usually takes much more time. The different abbreviations are not set in stone with Sunflower; in Edit | Preferences | Key bindings, the file manager lets you change the assignments. Table 1 summarizes the most commonly used keyboard shortcuts for file operations, and Table 2 shows keyboard shortcuts for navigating the directory tree and other activities.

Table 2

General Keyboard Shortcuts

Keyboard Shortcut

Function

Ctrl + B

Edit bookmark

Ctrl + D

Bookmark current directory

Ctrl + T

Duplicate current tab

Ctrl + Shift + T

Open directory in new tab

Ctrl + W

Close current tab

Ctrl + Tab

Activate next Tab

Ctrl + Shift + Tab

Change to the previous Tab

Ctrl + Z

Open Terminal

Ctrl + R

Update pane

Backspace

Change to the parent directory

Alt + Left arrow

Go back in history

Ctrl + Backspace

Show history

Esc

Close history

Alt + letter

Quick search

Alt + number

Switch to bookmark

Menu or Shift + F10

Display menu

Ctrl + Menu

Open with menu

Ctrl + Left arrow or Ctrl+Right arrow

Use path from opposite panel

Alt + F3

Toggle preview function

F4

Text editor

Enter

Apply default action to selected files

Ctrl + Enter

Open current path in new tab

Ctrl + Alt + P

View options

F11

Switch to full-screen mode

Ctrl + Q

Quit Sunflower

Table 1

Keyboard Shortcuts for File Operations

Keyboard Shortcut

Function

Ctrl + A

Select all flies

F8 or Delete

Delete selection

Num + *

Invert selection

Num + +

Select by pattern

Num + -

Unselect by pattern

F5

Copy selection

F6

Move selection

Ctrl + C

Copy selected files to the clipboard

Ctrl + X

Move selected files to the clipboard

Ctrl + V

Paste from clipboard

Alt + Num + +

Select by (same) extension

Alt + Num + -

Unselect by (same) extension

Ctrl + F1

Bookmark for left pane

Ctrl + F2

Bookmark for right pane

F7

Create directory

Ctrl + F7

Create empty file

Ctrl + H

Show/hide hidden files (dot files)

F12

Compare directories

One special feature of Sunflower is that file operations like copying, renaming, or moving files and directories can be applied to a group of selected files. While Midnight Commander only offers a few options for selecting multiple files in a single step, Sunflower lets you do this in very different ways: For example, it is possible to select an entire file type based on the file extension or, of course, to create selections on the basis of name patterns.

If you work with Total Commander on Windows – or still remember Norton Commander from many years ago – you might be also used to selecting files with a right-click for subsequent file operations. Sunflower offers this option, too, but you first need to enable the function in Edit | Preferences | Item List | Operation | Right click selects items. However, this modifies the behavior of the contextual menu, which otherwise uses the right mouse button: You need to press the mouse button somewhat longer in this case.

Practical Sunflower

As with other file managers, switches at the bottom of the main window apply frequently used file operations, such as copy or move, to the current selection. To display or hide this bar as required, click View | Show command bar. Selecting Silent mode when you Copy of Move items makes lengthy file operations convenient by displaying error messages collectively at the end of all processes (Figure 3).

Figure 3: For file operations, the Sunflower file manager has special options, such as "Quiet mode".

To add bookmarks to important and frequently used directories, use the bookmark button in the header bar of the panel; Sunflower lets you to use intuitive names. Selecting Edit | Preferences | Bookmarks (or pressing Ctrl+B) calls the bookmark manager, where you can manage and rearrange your bookmarks. To access saved bookmarks directly, press Alt+<n> to go to bookmark n.

One of my favorite features is the ability to select all the files that match the file type of the currently selected file by pressing Alt+Num++ in the numeric keypad. For example, you can copy all RAW files from the memory card of a digital camera with just a few keystrokes. Pressing Alt+Num+- inverts this operation and excludes the file type of the currently selected file from the selection. You can monitor the progress of longer file operations under Operations without the file manager blocking further actions.

A relatively new feature in Sunflower is the way the file manager manages the directories you visited in a history. Ctrl+Backspace opens the corresponding history window (Figure 4) and supports certain actions with the existing entries. Pressing Ctrl+L opens a specific directory, as in some other file managers. The command is linked to directories that you can access directly.

Figure 4: Previously used commands are stored in a history.

Sunflower offers different methods of sorting the file list: the file manager usually sorts enumerated files (e.g., 1.png, 10.png, 2.png, 21.png) alphabetically, but you can go to Edit | Preferences | Item List | Operation | Number sensitive item sorting to change to a numeric sort order. Now you'll see the files sorted correctly as 1.png, 2.png, 10.png, 21.png (Figure  5).

Figure 5: Adjusting how numeric directory entries are sorted.

In the same dialog, you will also find the settings for a quick search. To select a specific directory, just type its name. Sunflower then jumps letter by letter to the desired destination, and you do not even have to start with the first letter of the file name; for example, to find the file IMG4711.jpg, you can simply enter 47. If do not like the quick search live, you can enable after an additional switch is pressed (i.e., Ctrl, Alt, or Shift).

A very powerful plugin is enabled by default in the file manager for batch renaming of larger selections of files. Clicking Tools | Advanced rename (Figure 6) automatically applies the tool to previously selected files. In the template, you specify the name; pressing N or, say, N0-3 accepts the old name, or only parts of it; pressing E lets you add the appropriate file extension, and C adds a counter to the new file name.

Figure 6: Especially when renaming multiple files, Sunflower offers many useful options.

Expandable

One of Sunflower's strengths is its extensibility through plugins. The Sunflower wiki on Google Code [5] describes the structure of the plugins and also presents a simple example. Users with Python skills will not find it difficult to develop their own extensions or supplement existing ones. On the project page [6], you will also find more extensive Sunflower extensions, such as image manipulation (which no longer needs an up-to-date python2 library), archive management, and a SQLite viewer.

To install the plugins, unpack the downloaded archive to ~/.config/sunflower/user_plugins/<pluginname> in your home directory. After you restart the file manager, the plugins are available in the form of new menu items and functions.

Commands

One particular strength of Sunflower is that you can integrate arbitrary terminal commands seamlessly via the Commands menu. You thus have the option of adding your own custom commands (e.g., mogrify-format jpg "%S" to convert images to JPG format) and applying them to selected files or directories. Clicking Commands | Edit commands opens the corresponding dialog box (Figure 7).

Figure 7: Functions can be extended to include your own commands.

Sunflower supports three variants in terms of arguments for the commands: %l represents the selected files in the left panel, %r the files in the right panel, and %s those in the current (active) window, with lowercase and uppercase options in each case.

Uppercase tells Sunflower to pass the absolute path to the command. But, watch out: As in the terminal, you need to pay attention to spaces in the paths (i.e., you need to quote the arguments, as in "%S"). If you terminate the line with an ampersand (&), the programs run asynchronously, as in the shell.

An underscore in a command name, such as _resize, lets you define keyboard shortcuts and thus quickly call your own commands. This function was not fully implemented in the current version 0.1a when this issue went to press; however, the developer assured a fix in a timely manner.

Conclusions

The maintainer of Sunflower, Mladen Mijatov, says his program is at an early stage of development. Nevertheless, he has created an interesting tool that does not close, but definitely reduces, the gap between the terminal and the GUI. It will be exciting to be seen how far and how quickly he implements and releases the announced changes.