A simple file manager using dmenu
A simple dmenu file manager written in POSIX-compliant shell script.
Distrotube introduced my project much better than I would.
PCP
to copy path.
NEW
to make new file / directory
MVV
to move file
YAK
to copy files
LNK
to create symbolic links
DEL
to remove
TRH
to put in trash.
REM
to rename files / directories
HIS
to record history
BMK
to store as bookmarks
CMD
to store command
SDO
to enter super user mode
EYE
to preview your file
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
for EYE
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).
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.
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.../
to go back to parent directory../
to open your file manager in current working directory (determined by xdg-open
)/
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.
PCP
to copy path.Example:
$HOME
(your user's own home directory), if ESC
is pressed to leave dmenufm, then $HOME
will be copied into xclip
../
, and the current working directory will be copied.NEW
to make new file / directoryName with slash will consider as a directory; without as file.
dirname/
to create new directory, and filename
to create new file.MVV
to move file./
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.YAK
to copy filesMVR
, but will copy the file instead of moving it.LNK
to create symbolic linksMVR
, but will create the symbolic link for the file instead of moving it.DEL
to removeDelete 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.TRH
to put in trash.$HOME/.cache/dmenufm/trash
is the directory storing trashes for dmenufm.Move file to trash
will generate a new dmenu prompt.
./
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
will cd
to trash directory.Empty trash
will remove all files/directories in trash directory.REM
to rename files / directories$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.HIS
to record history$HOME/.config/dmenufm/dmenufm_history
.BMK
to store as bookmarks$HOME/.config/dmenufm/dmenufm_bookmark
Add BMK
to browse between directories using new dmenu prompt.
./
to confirm.CMD
to store command$HOME/.config/dmenufm/dmenufm_command
.$HOME/.config/dmenufm/dmenufm_command
.ncdu
, then dmenufm will open a terminal to run this command.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.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 modeEnter you password to enter super user mode (sudo).
The prompt will be all red because this is a dangerous action.
EYE
to preview your fileThe 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
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
minor/major
) of the fileFor 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
# Go to directory
cd ~/.config/sxhkd
# find the filetype
xdg-mime query filetype sxhkdrc
Find filetype text/x-matlab
xdg-open
default applications:
xdg-mime default nvim.desktop text/x-matlab
and you are all set.
See Configuration
dmenu
See
See Issues
.
GNU General Public License v3.0
See LICENSE.md
for detail information.