Why QtFM Could Become My Favorite Linux File Manager

Laptop on a blue background showing a Linux command prompt.
fatmawati achmad zaenuri/Shutterstock.com

The Qt file manager called QtFM has great features, such as storing custom commands so you don’t need to open a Linux terminal window to run them. The only drawback is getting it installed. Let’s look at what makes this file browser special and how you can (maybe) try it out.

What Makes QtFM a Great Linux File Manager

Anyone using a graphical desktop environment uses a file manager. On Linux, there are lots to choose from. Choice is good, as long as the different offerings actually offer something different.

Most file managers, also called file browsers, do the same things. They let you navigate the file system, and inspect or select files and directories. You can copy and move files using drag and drop. You can delete or rename files, and open files or run applications by clicking on them.

Other actions can be performed by right-clicking a file or directory, or the background of a directory, and selecting options from context-menus. The Qt file manager, QtFM, makes it easy to add extension-sensitive custom commands called actions to right-click context menus.

A custom action will only appear in the context menu when the file you’ve right-clicked matches the definition of an action. You can have a great many commands defined, but you’ll only see the ones that are relevant to the file you’ve clicked.

By placing that functionality within the file manager, you reduce the number of times you need to hop out to a terminal window. And because you don’t need to type in the command, you won’t mistype it.

Also, because the command isn’t entered through a terminal window it won’t end up in your command history. You don’t need common, repetitive commands cluttering up your history.

RELATED: The Best Alternative File Managers for Windows, Mac, and Linux

Installing QtFM

The only problem with QtFM is it might not be available for your Linux distribution. Some distributions have QtFM packaged in their repositories, but many do not. Surprisingly, neither Fedora nor Ubuntu do.

If a Linux project doesn’t want to support many different packaging formats, it usually delivers a Flatpak, Snap, or AppImage. QtFM doesn’t do any of that, and no one else seems to have bothered, either. Perhaps that’s because these formats inevitably introduce launch-time delays, and no one wants a laggy file manager. Speed of launch is crucial. A slow file manager would grow very old, very quickly.

The only other option you have is installing from source. QtFM is written using the Qt application GUI toolkit. It works with many different desktop environments. “Qt” is apparently pronounced “cute”, but there’s nothing cute about installing QtFM by hand.

The build instructions are given on the project’s GitHub page. As of January 2023, they didn’t work for us, after many attempts. Perhaps the instructions need updating. QtFM is still an active project, with commits added to their GitHub within the last two months, so perhaps the instructions will be updated, or expanded and clarified.

Luckily for me, QtFM has been packaged for Arch-based distributions, and can be found in the Arch User Repository. That means you can install it on any Arch-based distribution using your favorite AUR helper.

For example, to install it on Manjaro, using yay, all you need to do is type:

yay qtfm

Installing QtFM on Manjaro using the yay AUR helper

If you don’t already have yay, you can install it with:

sudo pacman -S yay

Getting Around in QtFM

QtFM follows the traditional file manager design. A list of locations and directories is displayed in a side pane on the left. A single click selects a location. The main panel displays files and directories located in the current location. Double-clicking a directory in the main panel opens that directory.

The default QtFM interface

Buttons on the toolbar take you to your previous location, up one directory level, or to your home directory. The path to the currently viewed location is displayed.

On our test computer, GNOME was set to use dark mode, and QtFM automatically matched this. However, QtFM stayed in dark mode when GNOME was switched to light mode, even after closing and re-opening QtFM. QtFM has an option in Edit > Settings > Appearances but this didn’t have any effect.

QtFM's dark mode check box

On a different computer running EndeavourOS, light mode and dark mode worked as expected.

QtFM in light mode

The list of locations in the side pane is pretty sparse to start with. To populate the list with your own selected locations, right-click on a directory in the main pane and select “Add bookmark” from the context menu.

The location list in QtFM populated with personal locations and ordered by dragging entries into preferred positions

You can also click an entry in the side pane to drag it up and down so that it occupies a new position in the list.

Right-clicking the background of the main panel opens a context menu that lets you create a new file or directory, move up one directory level, move to the previous location, add a bookmark, or see the properties of the current directory.

QtFM has four short menus. Many of the menu actions are mapped to keyboard shortcuts. These are the ones you’ll probably use the most.

  • Ctrl+N: Open a new QtFM instance.
  • Ctrl+T: Open a new tab.
  • Ctrl+W: Close the current tab.
  • Ctrl+C: Copy.
  • Ctrl+V: Paste.
  • Alt+Up: Move up one level in the directory tree.
  • Backspace: Move to the previous location.
  • Ctrl+H: Toggle showing hidden files.
  • Del: Move to Trash.
  • Shift+Del: Delete immediately, don’t move to Trash.
  • F1: Open a terminal window in the current location.
  • Ctrl+Q: Quit. Closes QtFM.
  • F2: Rename the highlighted file or directory.
  • Ctrl+-: Zoom out.
  • Ctrl++: Zoom in.
  • F3: Toggle icon and list views.
  • F4: In list view, toggles detailed display.
  • F5: Refresh current view.

To open a terminal window at the current location, click the “Terminal” button at the far right of the toolbar. By default this is set to open xterm, which is found on most Linux systems.

The "Open a terminal" button in the QtFM toolbar

You can change this to open your preferred terminal emulator by accessing the “Settings” dialog from Edit > Settings. Change the “Command” field for the “Terminal Emulator” entry in the “General” pane.

For GNOME, this will be “gnome-terminal.”

Changing the terminal emulator that will be opened by the QtFM "Open terminal window" button

If you’ve installed a different terminal emulator, enter the command used to launch it.

The Best Part: Custom Actions

For my needs, the power of QtFM lies in the way it allows you to easily create custom actions. These are commands that are applied to a file or directory. When they are applied to files they are file-extension sensitive. When you right-click a file you’ll only see the custom actions that are applicable to that file type.

To create custom actions, navigate to Edit > Settings > Custom Actions.

The list of custom actions

The existing custom actions are displayed. The four buttons beneath the list of actions are:

  • Restore the custom actions to their default values.
  • Display a short help text.
  • Add a new action.
  • Delete the highlighted action.

A custom action is made up of:

  • Filetype: This can be a file extension, an asterisk “*” meaning all files and directories, “folder” meaning any directory, or the name of a specific directory.
  • Text: A text description of the action.
  • Icon: You pick the icon from a long list that QtFM populates from the available icons on your computer.
  • Command: The actual command that you want to have executed. This is in standard shell syntax, with a few special tokens. You can use “%f” to represent the selected file of files, “%F” to represent the selected file or files together with their full file system path, or “%n” to represent the current file name.
  • Checkbox: The checkbox in each command field is used in conjunction with the “Show Dialog With Action’s Output” checkbox. When that checkbox is selected, all commands that have their individual checkboxes selected will show a dialog box that shows the details of the command as it runs, and captures any output from the command.

Click the “+” button to create a new custom action. An empty action is added to the bottom of the list.

A blank custom action added to the bottom of the list of existing custom actions

Double-click one of the empty fields to edit it. We’re going to set up a custom action to call the pandoc document conversion utility to create an HMTL version of a Markdown file.

Our field entries are:

  • Filetype: “MD”, the default Markdown file extension.
  • Text: “Create HTML”.
  • Icon: The pandoc utility doesn’t have an icon, so we left this blank.
  • Command: “pandoc -o draft.html %f.” This tells pandoc to create a file called “draft.html” from the Markdown in the file named “%f.”

The completed custom action

Click the “Save” button when you have filled in the fields.

If we navigate to a location that has a Markdown file in it, we can check our new custom action. We have two files in our “~/Documents” directory. One is a markdown file, the other is a LibreOffice document.

Right-clicking the ODT file produces a context menu. As we expect, the new custom action doesn’t appear.

A context menu without the custom action

The new action does appear in the context menu for the Markdown file.

A context menu with the custom action

If we select the custom action, pandoc is invoked and an HTML file is created called “draft.html.”

The newly created HTML file.

RELATED: How to Use pandoc to Convert Files on the Linux Command Line

Great, Apart From the Installation

QtFM is a great file manager in many ways, but it isn’t going to gain a wider adoption unless the installation process is simplified for more Linux distributions.

That’s a pity because the custom actions and their ease of use really set QtFM apart from other file managers. Even if you didn’t want to adopt QtFM as your regular file manager, it may be worth configuring some custom actions that’ll help optimize one of your more fiddly workflows, and using it just for those occasions.

RELATED: Which Linux File System Should You Use?

Source link