Home

Awesome

Dmenufm

A simple dmenu file manager written in POSIX-compliant shell script.

Distrotube introduced my project much better than I would

Distrotube introduced my project much better than I would.

Table of Content

<!-- vim-markdown-toc GFM --> <!-- vim-markdown-toc -->

Preview

Dmenufm Introduction 1 Dmenufm Introduction 2

Dependencies

With POSIX-compliance in mind, dmenufm makes use of and requires (or recommends) the below utilities.

In Debian- or Ubuntu-based distributions of Linux, the packages needed (versions are a guideline) are listed below, at least as is the case in Ubuntu 16.04 (Xenial).

Installation

For Arch Linux user, there is an AUR package available.

cd into the Makefile directory, and type sudo make install in terminal to install dmenufm.

To uninstall dmenufm, type sudo make uninstall in terminal.

Usage

  1. Type dmenufm to launch, or assign dmenufm to your favorite hot key. You may supply a directory as an argument to start dmenufm in the specified directory.
  2. ../ to go back to parent directory.
  3. ./ to open your file manager in current working directory (determined by xdg-open)
  4. Choices with / are directory; choices without / are files.

Usage output (as of 2019-12-16) showing optional arguments for custom usage:

$ dmenufm --help
            DMENUFM
            Written by huijunchen9260 <chen.9260@osu.edu>

            Simple file manager using dmenu

SYNTAX:     dmenufm [OPTS]

OPTS:       -h | --help               - Show this usage information.
            -d | --directory          - Only directories.
            -f | --file               - Only show files.
            -D | --dotdirectory       - Only show hidden directories.
            -F | --dotfile            - Only show hidden files.
            -p | --lastpath           - Opens in last working directory. (cd on exit)
            -r | --rollingmenu        - Rolling menu based on selected files.
            -t | --termpath           - Print out the path of file / directory.
	    -m | --menu               - Choose other menu system
	    -o | --option             - Choose options for other menu system
	   -no | --notif-option      - Choose NotiPrompt options for other menu system
	   -do | --danger-option     - Choose DangerPrompt options for other menu system

Terminal

Terminal to open terminal in current working directory. To define terminal, add export TERMINAL=<your terminal> to the end of your .bashrc file (or any other system configuration file, like .profile, zshrc, etc).

Open in...

Open in... to temporarily open a file in a different program from FM_OPENER or xdg-open.

Requires dmenu_path. This function use dmenu_path to search for programs that is going to open the next selected file.

CD on Exit

Use -p | --lastpath option:

dmenufm -p

Rolling Menu

Use -r option for rolling menu based on the file that you opened:

dmenufm -r

For example, the original list is

../
./
Actions
Terminal
file1
file2
file3
file4

You open file3. After you close file3, the menu would be

../
./
Actions
Terminal
file3
file4
file1
file2

Actions

Actions is the actions you can do.

PCP to copy path.

Example:

NEW to make new file / directory

Name with slash will consider as a directory; without as file.

MVV to move file

YAK to copy files

LNK to create symbolic links

DEL to remove

Delete directories or files.

TRH to put in trash.

REM to rename files / directories

HIS to record history

BMK to store as bookmarks

CMD to store command

CMD Notes:

GUI application will open only one windows, and terminal application will open a terminal for this command.

If there is no terminal opened for your terminal application, you need to modify executecmd function in dmenufm.

ExecCMD () { # Usage ExecCMD [CMD]
    software=$(printf '%s' "${1%% *}")
    appdesktop=$(find "$XDGDIR1" "$XDGDIR2" -name "*$software*.desktop" | tail -n 1)
    if [ -n "$appdesktop" ] && grep 'Terminal=false' "$appdesktop"; then
	printf '%s' "$1" | ${SHELL:-"/bin/sh"}
    else
	$TERMINAL -e $1 | ${SHELL:-"/bin/sh"}
    fi
}

$TERMINAL -e $1 is the one you need to modify.

SDO to enter super user mode

Enter you password to enter super user mode (sudo).

The prompt will be all red because this is a dangerous action.

EYE to preview your file

The EYE prompt will appear at the button of the screen.

Recommend using this function with Rolling Menu

Need wmctrl to automatically close the opened file.

Open files

Files are opened using xdg-open. If you have any trouble, go to troubleshooting on xdg-open

For compression, now you can choose the compression, and it will extract into a new directory named by the compression.

Configuration

There are many environment variables you can use to configure dmenufm by exporting them in your system or shell configuration file.

Alternatively, you can cp /etc/dmenufm.conf $HOME/.config/dmenufm/dmenufm.conf and modify $HOME/.config/dmenufm/dmenufm.conf to your needs.

Use other menu system

To use other menu system, you need to specify seven additional variables in dmenufm.conf. Take the default value for bemenu as example:

FM_PROG="bemenu"
FM_OPTS="-l 10"
FM_OPT_PROMPT="-p"
FM_OPTS_GENERIC="--sb='#005577'"
FM_OPTS_ACTION_LV1="--sb='#33691e'"
FM_OPTS_ACTION_LV2="--sb='#FF8C00'"
FM_OPTS_ACTION_BULK="--sb='#CB06CB'"

Use terminal menu system

The terminal menu system, such as fzf and shellect, will slightly change the stty settings in an unknown way such that the original terminal color scheme will be distorted when opening text files in vim/neovim. The way to fix it is to use install a vim/neovim colorscheme, and include the following line in your .vimrc / init.vim:

set tgc

This will enable the termguicolors setting inside vim/neovim, and force the color scheme to match your installed vim/neovim color scheme.

Note

If you hate GUIarrowy world like me, based on man dmenu, you can

where Meta is also called Alt.

Troubleshooting

Why some of my GUI app will open in terminal?

For GUI application like sxiv, default setting will open sxiv in a new terminal. In total, 2 windows will be opened.

This is because sxiv.desktop has no Terminal=false entry.

To fix this, use

< $(locate sxiv.desktop | tail -n 1) sudo ${EDITOR:-vi}

to open .desktop file in your editor, and add

Terminal=false

You can replace sxiv to any GUI application which has the same issue.

Why files do not open in the right application

dmenufm use xdg-open to open files in the default application.

To open in the application that you want, you need to

  1. find the filetype (minor/major) of the file
  2. Set xdg-open default applications.

For example, I am using sxhkd. So I need to modify sxhkdrc. However, it is not opened in nvim.desktop, but in firefox.desktop.

So I

  1. find the filetype:
    # Go to directory
    cd ~/.config/sxhkd
    # find the filetype
    xdg-mime query filetype sxhkdrc
    
    Find filetype text/x-matlab
  2. Set xdg-open default applications:
    xdg-mime default nvim.desktop text/x-matlab
    

and you are all set.

I want to configure the color and font of dmenufm

See Configuration

I want to use menu system other than dmenu

See

TODO

See Issues.

License

GNU General Public License v3.0

See LICENSE.md for detail information.