A simple dmenu file manager written in POSIX-compliant shell script.
- Minimal (only require POSIX compliant shell and coreutils)
- File management (yank, move, symbolic link, ranger style bulk rename, etc)
- Remember you last path (CD on Exit)
- Rolling menu for dynamic file browsing (Rolling Menu)
- Compatible with other menu system
Distrotube introduced my project much better than I would.
- Preview
- Dependencies
- Installation
- Usage
- Terminal
- Open in...
- CD on Exit
- Rolling Menu
- Actions
PCP
to copy path.NEW
to make new file / directoryMVV
to move fileYAK
to copy filesLNK
to create symbolic linksDEL
to removeTRH
to put in trash.REM
to rename files / directoriesHIS
to record historyBMK
to store as bookmarksCMD
to store commandSDO
to enter super user modeEYE
to preview your file
- Open files
- Configuration
- Note
- Troubleshooting
- TODO
- License
With POSIX-compliance in mind, dmenufm makes use of and requires (or recommends) the below utilities.
sed
,grep
xclip
,find
cat
,wc
,cp
,mv
,rm
,mkdir
,touch
(GNU coreutils)wmctrl
forEYE
actiontar
,unlzma
,bunzip2
,unrar
,unzip
,uncompress
,7z
,unxz
,cabextract
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).
- bzip2 >= 1.0.6-8
- findutils >= 4.6.0+git+20160126-2
- grep >= 2.25-1~16.04.1
- gzip >= 1.6-4
- sed >= 4.2.2-7
- suckless-tools >= 42-1
- tar >= 1.28-2.1
- unzip >= 6.0-20
- xclip >= 0.12+svn84-4
- xz-utils >= 5.1.1alpha+20120614-2
For Arch Linux user, there is an AUR package available.
- In order for this to work you need to install
make
,git
,dmenu
- Install this programs.
- clone this gitrepo
git clone https://github.com/huijunchen9260/dmenufm/
- cd to the repo directory you just cloned
cd dmenufm
- run
sudo make install
To uninstall dmenufm, type sudo make uninstall
in terminal. On the gitrepo directory.
- Type
dmenufm
to launch, or assigndmenufm
to your favorite hot key. You may supply a directory as an argument to start dmenufm in the specified directory. ../
to go back to parent directory../
to open your file manager in current working directory (determined byxdg-open
)- 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 <[email protected]>
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
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...
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.
Use -p | --lastpath
option:
dmenufm -p
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
is the actions you can do.
Example:
- current working directory is
$HOME
(your user's own home directory), ifESC
is pressed to leave dmenufm, then$HOME
will be copied intoxclip
. - You can browse into the directory; inside that directory, choose
./
, and the current working directory will be copied.
Name with slash will consider as a directory; without as file.
- Example: Type
dirname/
to create new directory, andfilename
to create new file.
- To move file to destination:
- Choose source and destination to move your file. Enter the directory and choose
./
to confirm the destination. Bulk Move
for multi-selectionBulk Move All
to move all the content in the directory.Bulk Move Mass
to move contents that is selected by editing the list of content in default text editor.
- Choose source and destination to move your file. Enter the directory and choose
- The usage of this action is the same as
MVR
, but will copy the file instead of moving it.
- The usage of this action is the same as
MVR
, but will create the symbolic link for the file instead of moving it.
Delete directories or files.
Bulk Delete
for multi-selectionBulk Delete All
to delete all the content in the directory.Bulk Delete Mass
to delete contents that is selected by editing the list of content in default text editor.
$HOME/.cache/dmenufm/trash
is the directory storing trashes for dmenufm.Move file to trash
will generate a new dmenu prompt.- Choose any file to move to trash.
- To move a directory to trash, enter the directory, and choose
./
to confirm this directory.. Bulk Trash
for multi-selectionBulk Trash All
to delete all the content in the directory.Bulk Trash Mass
to delete contents that is selected by editing the list of content in default text editor.
Go to trash
willcd
to trash directory.Empty trash
will remove all files/directories in trash directory.
- Open the name of the selected files / directories to your
$EDITOR
/ text editor.Bulk Rename
for multi-selectionBulk Rename All
to rename all the content in the directory.Bulk Rename Mass
to rename contents that is selected by editing the list of content in default text editor.
- history file stored in
$HOME/.config/dmenufm/dmenufm_history
. - The maximum number of history is 5000.
- Choose the listed bookmark to enter that directory. Bookmarks are stored in
$HOME/.config/dmenufm/dmenufm_bookmark
- Choose
Add BMK
to browse between directories using new dmenu prompt.- To add file to bookmark, choose files in new dmenu prompt.
- To add directory to bookmark, enter the directory and choose
./
to confirm.
- Choose "Delete BMK" to delete one file/directory in bookmark.
- Choose "Add CMD" to add both the command and command description in
$HOME/.config/dmenufm/dmenufm_command
. - Choose "Delete CMD" to delete any command in
$HOME/.config/dmenufm/dmenufm_command
. - Choose any stored command to execute.
- If your command is a single command with no argument, e.g.
ncdu
, then dmenufm will open a terminal to run this command. - If your command has arguments, e.g.
chmod +x $1
, you only need to write one argument ($1
part), and dmenufm will open a bulk mode, which allows you to choose files to execute.
- If your command is a single command with no argument, e.g.
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.
Enter you password to enter super user mode (sudo).
The prompt will be all red because this is a dangerous action.
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.
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.
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.
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'"
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.
If you hate GUIarrowy world like me, based on man dmenu
, you can
Ctrl-n
to go up,Ctrl-p
to go down,Ctrl-y
to paste from primary X selection- Everything your "are selecting" can be paste into dmenu by this hot key.
Meta-h
to go up,Meta-l
to go down,Meta-k
to go one page up,Meta-j
to go one page down,
where Meta
is also called Alt
.
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.
dmenufm
use xdg-open
to open files in the default application.
To open in the application that you want, you need to
- find the filetype (
minor/major
) of the file - 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
- find the filetype:
Find filetype
# Go to directory cd ~/.config/sxhkd # find the filetype xdg-mime query filetype sxhkdrc
text/x-matlab
- Set
xdg-open
default applications:xdg-mime default nvim.desktop text/x-matlab
and you are all set.
See Configuration
See
See Issues
.
GNU General Public License v3.0
See LICENSE.md
for detail information.