dmenu is a fast and lightweight dynamic menu for X. It reads arbitrary text from stdin, and creates a menu with one item for each line. The user can then select an item, through the arrow keys or typing a part of the name, and the line is printed to stdout. dmenu_run is a wrapper that ships with the dmenu distribution that allows its use as an application launcher.
Install the package, or AUR for the development version.
Various patched variants exist which extend dmenu's default functionality. Consider installing one of the following packages from the AUR:
- AUR: dmenu fork with many useful patches applied and additional capabilities added including dimming, specifying a custom opacity, and underlining.
You may run dmenu with:
Now, you will want to attach the
dmenu_run command to a keystroke combination. This can be done either via your window manager or desktop environment configuration, or with a program like . See the Hotkeys article for more information.
Displaying custom items
Custom items will be shown by separating them with a new line (\n) and piping them into dmenu. For example:
$ echo -e "first\nsecond\nthird" | dmenu
Manually adding items
dmenu will look for executables in the directories defined in your
$PATH. For information on modifying your
$PATH see environment variables.
dmenu can display fonts using XFT. This example will run dmenu using :
$ dmenu_run -fn 'Droid Sans Mono-9'
Support for shell aliases
dmenu does not support shell aliases. To have dmenu recognize your aliases, install the AUR package from the AUR and run
dmenu-recent-aliases. Your aliases must be in
~/.bash_aliases to be recognized by dmenu-recent-aliases.
Support for history
To sort commands by recency, download dmenu_run_history to your
$PATH and use
dmenu_run_history instead of
Tips and tricks
Inside a script (e.g. launched from a shortcut), getting user input is sometimes required. We can use dmenu for this, by passing it an EOF: the selection field will be empty and dmenu can take user input.
/dev/null will return an EOF, this can simply be done by the following command:
$ dmenu -p 'Enter input' < /dev/null
No locale support
Running dmenu_run results in the following error message:
no locale support
Make sure that the environment variable
LANG is correctly set. See the following for more information: Locale#Troubleshooting
If certain entries are missing from dmenu, the cache may be malformed. Delete it and restart dmenu.
$ rm ~/.dmenu_cache $ rm ~/.cache/dmenu_run
Note that there will most likely be only one cache file, depending on if
$XDG_CACHE_HOME is set. See the contents of
/usr/bin/dmenu_run for more information.
Environment variables needed for applications should instead be added to