-
Notifications
You must be signed in to change notification settings - Fork 2
Home
dmenu is a dynamic menu for X and was originally designed for dwm. It manages large numbers of user-defined menu items efficiently.
dmenu is commonly confused as being the menu in dwm to launch programs - but this is merely a shell script called dmenu_run that uses dmenu to present options and executes the user's choice.
It is easiest to explain what dmenu is with a basic example.
Here we are using echo to pass the options of Apples
, Pears
and Bananas
to dmenu via standard
in. The options are separated by newline as each line will be a separate menu item in dmenu.
$ echo -e "Apples\nPears\nBananas" | dmenu
This will result in the following menu to be displayed:
The user can now use left or right to select items or start typing to narrow down the options:
Pressing enter will make dmenu return the given menu option via standard out.
$ echo -e "Apples\nPears\nBananas" | dmenu
Pears
$
This allows for shell scripts to use dmenu to present options and take different actions depending on what the user selects.
Refer to https://tools.suckless.org/dmenu/scripts/ for example scripts that can be used with dmenu.
For command line arguments refer either to the dmenu man page or the dmenu --help
output.
usage: dmenu [-bcfiIjJkKnNrRsStuUvxyz] [-bw width] [-g columns] [-gw width] [-l lines] [-p prompt]
[-dy command] [-it text] [-hp items] [-H histfile] [-h height] [-ps index]
[-x offset] [-y offset] [-z width] [-m monitor] [-w windowid]
[-fn font] [-nb color] [-nf color] [-sb color] [-sf color] ...
dmenu is a dynamic menu for X, which reads a list of newline-separated items from stdin.
When the user selects an item and presses Return, their choice is printed to stdout and
dmenu terminates. Entering text will narrow the items to those matching the tokens in the
input.
Placement options:
-t dmenu is shown at the top of the screen (default)
-b dmenu is shown at the bottom of the screen
-c dmenu is shown in the center of the screen
-e <windowid> embed into the given window ID
-ea embed into the currently focused (active) window
-m <monitor> specifies the monitor index to place dmenu on (starts at 0)
-x <offset> specifies the x position relative to monitor
-y <offset> specifies the y position relative to monitor
-w <width> specifies the width of dmenu
Appearance:
-bw <width> specifies the border width
-h <height> specifies the height of dmenu lines
-p <text>, -prompt <text> defines the prompt to be displayed to the left of the input field
-l <lines> specifies the number of lines for grid presentation
-g <columns> specifies the number of columns for grid presentation
-gw <width> specifies the minimum width of columns in a grid presentation
-pwrl <int> specifies the powerline separator to use (values 0 through 4)
-pwrl_reduction <pixels> adjusts the angle and size of the powerline separator
Colors:
-fn <font> defines the font or font set used
-fns <font> defines the selected item font or font set used
-fno <font> defines the output item font or font set used
-nb <color> defines the normal background color
-nf <color> defines the normal foreground color
-sb <color> defines the selected background color
-sf <color> defines the selected foreground color
-bb <color> defines the border background color
-bf <color> defines the border foreground color
-pb <color> defines the prompt background color
-pf <color> defines the prompt foreground color
-ab <color> defines the adjacent background color
-af <color> defines the adjacent foreground color
-ob <color> defines the out(put) background color
-of <color> defines the out(put) foreground color
-hb <color> defines the high priority background color
-hf <color> defines the high priority foreground color
-nhb <color> defines the normal highlight background color
-nhf <color> defines the normal highlight foreground color
-shb <color> defines the selected highlight background color
-shf <color> defines the selected highlight foreground color
For color settings #RGB, #RRGGBB, and X color names are supported.
Functionality:
-d <delimiter> separates the input in two halves; display first and return second
-D <delimiter> as -d but based on the last occurrence of the delimiter
-dp when using -d or -D, display first and return original line (double print)
-dy <command> a command used to dynamically change the dmenu options
-hp <items> comma separated list of high priority items
-it <text> starts dmenu with initial text already typed in
-ps <index> preselect the item with the given index
-f dmenu grabs the keyboard before reading stdin if not reading from a tty
-H <histfile> specifies the history file to use
-i, -NoCaseSensitive makes dmenu case-insensitive (default)
-I, -CaseSensitive makes dmenu case-sensitive
-j, -RejectNoMatch makes dmenu reject input if it would result in no matching item
-J, -NoRejectNoMatch input can be entered into dmenu freely (default)
-k, -PrintIndex makes dmenu print out the 0-based index instead of the matched text
-K, -NoPrintIndex makes dmenu print out matched text itself (default)
-n, -InstantReturn makes dmenu select an item immediately if there is only one matching option left
-N, -NoInstantReturn user must press enter to select an item (disables auto-select) (default)
-u, -PasswordInput indicates that the input is a password and should be masked
-U, -NoPasswordInput indicates that the input is not a password (default)
-s, -Sort enables sorting of menu items after matching (default)
-S, -NoSort disables sorting of menu items after matching
-r, -RestrictReturn disables Shift-Return and Ctrl-Return to restrict dmenu to only output one item
-R, -NoRestrictReturn enables Shift-Return and Ctrl-Return to allow dmenu to output more than one item (default)
-v prints version information to stdout, then exits
-xpad <offset> sets the horizontal padding value for dmenu
-ypad <offset> sets the vertical padding value for dmenu
-Alpha enables transparency
-NoAlpha disables transparency (default)
-ColorEmoji enables color emoji in dmenu (requires libxft-bgra)
-NoColorEmoji disables color emoji (default)
-ContinuousOutput makes dmenu print out selected items immediately rather than at the end
-NoContinuousOutput dmenu prints out the selected items when enter is pressed (default)
-FuzzyMatch allows fuzzy-matching of items in dmenu (default)
-NoFuzzyMatch enables exact matching of items in dmenu
-HighlightAdjacent makes dmenu highlight items adjacent to the selected item
-NoHighlightAdjacent only the selected item is highlighted (default)
-Incremental makes dmenu print out the current text each time a key is pressed
-NoIncremental dmenu will not print out the current text each time a key is pressed (default)
-Input enables input field allowing the user to search through the options (default)
-NoInput disables the input field, forcing the user to select options using mouse or keyboard
-Managed allows dmenu to be managed by a window manager
-NoManaged dmenu manages itself, window manager not to interfere (default)
-PrintInputText makes dmenu print the input text instead of the selected item
-NoPrintInputText dmenu to print the text of the selected item (default)
-PromptIndent makes dmenu indent items at the same level as the prompt on multi-line views
-NoPromptIndent items on multi-line views are not indented (default)
-ShowNumbers makes dmenu display the number of matched and total items in the top right corner
-NoShowNumbers dmenu will not show item count (default)
-Xresources makes dmenu read X resources at startup (default)
-NoXresources dmenu will not read X resources