LinuxCommandLibrary

dmenu

Display a menu of user-defined items

TLDR

Display a menu of the output of the ls command

$ [ls] | dmenu
copy

Display a menu with custom items separated by a new line (\n)
$ echo -e "[red]\n[green]\n[blue]" | dmenu
copy

Let the user choose between multiple items and save the selected one to a file
$ echo -e "[red]\n[green]\n[blue]" | dmenu > [color.txt]
copy

Launch dmenu on a specific monitor
$ ls | dmenu -m [1]
copy

Display dmenu at the bottom of the screen
$ ls | dmenu -b
copy

SYNOPSIS

dmenu [-b] [-f] [-F] [-fn font] [-h lines] [-i] [-ii] [-is] [-l lines] [-m monitor] [-nb color] [-nf color] [-p prompt] [-r] [-sb color] [-sf color] [-v] [-w width] [-x x] [-y y]

PARAMETERS

-b
    draw menu bar at bottom of screen

-f
    floating window mode (needs -w or slop)

-F
    floating centered window

-fn font
    X11 font to use (e.g., "monospace:pixelsize=12")

-h lines
    horizontal list of lines items

-i
    case-insensitive matching

-ii
    case-insensitive substring matching

-is
    case-insensitive, fallback to sensitive

-l lines
    vertical list of lines items (default 0)

-m monitor
    use monitor monitor (-1 for pointer)

-nb color
    normal background color (#RRGGBB)

-nf color
    normal foreground color

-p prompt
    input prompt text (default "[]")

-r
    right-align text

-sb color
    selected background color

-sf color
    selected foreground color

-v
    print version and exit

-w width
    menu window width in pixels

-x x
    x position offset

-y y
    y position offset

DESCRIPTION

dmenu is a lightweight, keyboard-driven menu for the X Window System, ideal for minimal window managers like dwm. It reads null-delimited or newline-separated items from stdin, displays them in a customizable bar (top or bottom of screen), and lets users type to filter matches instantly.

Selection via Enter executes the item as a shell command (sh -c). Arrow keys, Tab, or mouse (if enabled) navigate. It's blazing fast, uses minimal resources, and supports colors, fonts, multi-line views, and monitor positioning.

Commonly launched via scripts like dmenu_run, which pipes desktop entries or binaries. Filters are prefix-based by default (case-sensitive), but options enable insensitive, substring, or fuzzy matching. Perfect for power users avoiding bloated launchers; integrates seamlessly in tiling WMs for app switching, run dialogs, or custom lists.

Outputs selected text to stdout or executes directly. No daemon needed—runs on-demand.

CAVEATS

X11-only; Wayland needs wrappers like xwayland. No native mouse drag/resize in bar mode. Relies on stdin for items—no built-in caching.

KEYBOARD SHORTCUTS

Type: filter items
Enter: select/execute
Esc: cancel/exit
↑↓/PgUp/PgDn/Tab: navigate
Ctrl-C: kill menu

COMMON USAGE

ls ~/.local/bin /usr/bin | dmenu -i -l 15 | xargs -r sh -c
or use dmenu_run for apps

HISTORY

Created 2006 by Anselm Garbe (suckless.org) and Diego Giagio for dwm integration. Evolved via community patches; v5.2 (2023) adds floating mode, fuzzy matching. Maintained as suckless tool emphasizing simplicity.

SEE ALSO

dmenu_path(1), dmenu_run(1), rofi(1), wofi(1), dwm(1), slop(1)

Copied to clipboard