Unlimited WordPress themes, graphics, videos & courses! Unlimited asset downloads! From $16.50/m
  1. Computer Skills
  2. File Manager

fman: The Extendable File Manager for Any System


Being a developer, I use the file manager all the time. I often find myself wanting to extend the file manager to help me automate some of my tasks. Unfortunately, the default file manager on most systems has always been very limiting.

fman File Manager
fman File Manager

The fman file manager is a game changer. fman is a minimalist dual pane file manager. It is extendable like Sublime Text using Python. It has all the same keyboard defaults as Commander One and similar file managers. You can use it on macOS, Windows, and Linux.

As of February 2017, fman is still in a private beta program that anyone can request access. The author is planning on starting sales on 1st March 2017.

Power Go To

One of the unique features of fman is the power go to. When you press Command-P, fman prompts for a directory name.

Power Go To
Power Go To

fman searches for matches. If you have many directories with the word fman you'll see all the directory paths containing that word. This makes finding the right directory very easy.

User Preferences

If you do not like the standard hotkeys, you can change them in the User directory where the plugins live. On macOS the plugins directory is ~/Library/Application Support/fman/Plugins/

On Windows, the plugins directory is %APPDATA%\fman. On a Linux system, the plugins directory is ~/.config/fman

The User directory in the plugins directory contains the file Key Bindings.json. This JSON formatted file contains your preferences for the hotkeys. The file format is:

In this file, you specify the key to press and the command that you wish to execute. I use this file to figure out what commands come with the program.

The Command Prompt
The Command Prompt

Press Shift-Command-P in fman to show the command prompt in which a command can be executed. The command prompt displays any hotkey assignments to the command. 

To use a command in the command prompt type a space instead of an underscore. For example, the command show_volumes is run by typing show volumes in the command prompt.

You can launch any command in an extension from the command prompt. This feature is a convenient and a powerful way to get things done.

Adding Extensions

Extensions can be added to fman. From the extensions page of fman’s website, click any extension to download it. Then copy the extension’s full directory to the plugins directory.

fman With Status Bar Extender Plugin
fman With Status Bar Extender Plugin

By downloading the Status Bar Extender extension, the status bar will have more helpful information about the current directory for each pane.

Extensions can change the default behavior of fman

For example, my extension OpenWithEditor that overrides the open_with_editor built-in command. 

The built-in command opens the file with the default program for the extension. My extension overrides that command to open a file using the editor selected in my BitBar plugin currentFiles.1h.rb created in the BitBar tutorial on Tuts+.

Writing Extensions

To create extensions, first create a directory for the extension in the plugins directory. 

In this tutorial, I want an extension that will allow me to set a directory as the project directory and run a command script whenever entering this directory when a different project is set as the current project. 

So, when I leave one project directory that I have been working and go to a different project, it will execute the script to setup my environment. I’ll be creating this extension on macOS, but the exact same extension will work in Windows and Linux with some minor modifications.

To start, create the directory ProjectManager in the plugins directory. Then create another directory in this directory called projectmanager. This directory has to be all lower case and no spaces. 

Inside this directory, create the file __init__.py. You can have any other files in the directory that contains python code as well. When the extension is loaded, the code in this file gets executed first. It should load any other files as needed. 

In this file, add the following:

This code loads the libraries used in this extension. I’m pulling several functions from the fman library. These items are:

 Library or Function 
This is the object to subclass to create a directory level command.
DirectoryPaneListener This is the object to subclass to create a function that will listen to changes in the directory pane.
This function will show an alert dialog with the message given. 
This loads in json data files from the User directory. 
This is the directory for storing fman data. 
This gets an input from the user with the given message.

You can see all the functions available in the fman documentation page. Currently, it is a list of function names and their default inputs.

After loading the libraries, set up two global variables: PROJECTDIR and PROJESTSLIST.

These globals help make the directory checking function run quickly. That is important when writing a routine that executes every time fman changes directories.

The SetProjectDirectory class is a sub-class of DirectoryPaneCommand. The __call__ method is run whenever the command set_project_directory is run. 

This function gets the current directory, sets it as the current project, asks the user for a name for the project, saves that into a projects list file, creates the .startproject file, and opens it in the editor of choice by the OpenWithEditor extension or TextEdit.

The next command is ClearProjectDirectory. This command clears out the ~/.currentproject file.

The EditProjectStartScript command allows you to edit the .startproject script for the currently set project. 

You do not have to be in the project’s main directory to run this command but you must have a valid project set up.

The EnteringProjectDirectory command is the main command for this extension. All the other commands get this command to work.

Since it is a sub-class of the DirectoryPaneListener, it runs every time directories are changed. For that reason, this routine should be as short and fast as possible. Otherwise, fman will get very cumbersome to use. 

This command checks to see if it has entered a project directory. If so, it checks for being different from the currently set project. If that is true, then it sets the new project directory and runs the project’s .startproject script. 

To test the system, I added this code to the .startproject file:

This uses the Pashua program to show a calendar and clock. It makes for a quick visual check to see that the program is working.

The next item is the hotkey assignments for the extension. In the top of the extension directory, add this to the Key Bindings.json file:

Each extension can have assigned hotkeys to use. These get loaded before the same file gets loaded from the Users extension. 

In that way, the user can override anything setup in the extensions. I’m assigning Shift-S to the set_project_directory command. I’m assigning Shift-C to the clear_project_directory command. And, I’m assigning Shift-E to the edit_project_start_script command.

If you set the ProjectManager directory as the project directory, give it the project name Project Manager, exit the directory, clear out the projects with Shift-C or running the clear_project_directory from the command prompt, and then enter the directory again.

Executing the Test Script for Project Manager
Executing the Test Script for Project Manager

You will see the Pashua prompt showing the date and time. Now you can create start scripts that launch the text editor with the project files and organize the windows on the screen for better working. 

I use HammerSpoon to create the window layouts from a script. You could also run directory watchers to recompile your project and load into a web browser. 

The possibilities are endless.


Now that you know how to create extensions for fman, go ahead and create your own.

There are many ways you can extend the functionality of this simple extension. fman is a lot of fun to use and is very easy to extend to have the functionality you need.

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.