[2025-jun-17] The SlackDocs mailing lists at https://lists.alienbase.nl/mailman/listinfo have been retired. No one has been using these lists for years and it's time to say goodbye. The list archives remain available at https://scalzi.slackware.nl/mailman/listinfo/slackdocs

[2025-jun-17] The SlackDocs Wiki has moved to a new server, in order to make it more performant.

Welcome to the Slackware Documentation Project

dmenu

Work in progress. This page is a placeholder. Content will be expanded soon.

dmenu is a dynamic menu for X, originally designed for the suckless project. It is most commonly used as a lightweight application launcher in tiling window managers such as dwm, but it can also read arbitrary input from standard input, making it useful for any “pick one item from a list” task in shell scripts.

Installation

From SlackBuilds

From source

git clone https://git.suckless.org/dmenu
cd dmenu
make
sudo make install

Basic Usage

Launch dmenu with the default dmenu_run wrapper, which lists all executables in $PATH:

dmenu_run

In dwm, the default keybinding to launch dmenu_run is Alt + p.

Configuration

Like other suckless tools, dmenu is configured by editing config.h and recompiling. Configuration details, common patches, and customization examples will be covered in a future revision of this page.

dmenu as an Application Menu

dmenu is not limited to launching executables from $PATH. By piping a custom list into it, you can build an interactive application menu — similar to a desktop environment's app launcher.

The script below maps named entries to commands, mixing GUI apps, terminal apps, and system commands in a single menu:

#!/bin/sh
# Wrap a command in a terminal
# Replace 'st' with your terminal emulator (xterm, alacritty, urxvt...)
term() {
    st -t "$1" -e "${@:2}"
}
 
choice=$(printf "%s\n" \
    "Browser" \
    "Terminal" \
    "IRC" \
    "Mail" \
    "PDF" \
    "Editor" \
    "Files" \
    "Mixer" \
    "WiFi" \
    "Bluetooth" \
    "Reboot" \
    "Shutdown" |
    dmenu -i -l 12 -p "Menu" \
        -fn "Monospace-11" \
        -nb '#000000' -nf '#ffffff' \
        -sb '#005f87' -sf '#ffffff')
 
case "$choice" in
    # Browser: firefox, chromium, librewolf...
    Browser)    firefox ;;
    # Terminal: st, xterm, alacritty, urxvt...
    Terminal)   st ;;
    # IRC: senpai, irssi, weechat...
    IRC)        term IRC senpai ;;
    # Mail: mutt, neomutt, thunderbird...
    Mail)       term Mail mutt ;;
    # PDF: zathura, mupdf, evince...
    PDF)        zathura ;;
    # Editor: vim, geany, kate, micro...
    Editor)     geany ;;
    # Files: ranger, noice, nnn, thunar...
    Files)      term Files noice ;;
    # Mixer: pavucontrol, alsamixer...
    Mixer)      pavucontrol ;;
    # WiFi: nmtui, wifitui...
    WiFi)       term WiFi nmtui ;;
    Bluetooth)  blueman-manager ;;
    Reboot)     sudo /sbin/reboot ;;
    Shutdown)   sudo /sbin/poweroff ;;
esac

The -l flag displays entries as a vertical list, -p sets the prompt label, and -i makes matching case-insensitive.

Binding a Hotkey

To launch the menu with a keyboard shortcut, add an entry to your hotkey daemon. Example using sxhkd (~/.config/sxhkd/sxhkdrc):

# Menu
super + space
    $HOME/.bin/menu

Replace $HOME with the full path if your shell does not expand it, e.g. /home/username/.bin/menu.

If you use dwm, you can bind it directly in config.h without any extra daemon — the default keybinding for dmenu_run is Mod + p:

{ MODKEY, XK_space, spawn, SHCMD("$HOME/.bin/menu") },

See Also

Sources

QR Code
QR Code howtos:window_managers:dmenu (generated for current page)