dmenu
Display a menu of user-defined items
TLDR
Display a menu of the output of the ls command
Display a menu with custom items separated by a new line (\n)
Let the user choose between multiple items and save the selected one to a file
Launch dmenu on a specific monitor
Display dmenu at the bottom of the screen
SYNOPSIS
dmenu [-v] [-b] [-f] [-i] [-l lines] [-m monitor] [-p prompt] [-fn font] [-nb color] [-nf color] [-sb color] [-sf color] [-w windowid]
PARAMETERS
-v
Prints version information to stdout, then exits.
-b
Causes dmenu to appear at the bottom of the screen.
-f
Disables keyboard grabbing, allowing other programs to receive keyboard input while dmenu is open. Useful when piping from other commands.
-i
Performs case-insensitive matching when filtering items.
-l lines
Causes dmenu to display the specified number of lines vertically. By default, it displays as many as fit horizontally.
-m monitor
Displays dmenu on the specified monitor (e.g., '0' for the primary monitor).
-p prompt
Displays the given prompt text before the input field.
-fn font
Uses the specified font for displaying text.
-nb color
Sets the background color for normal (unselected) items.
-nf color
Sets the foreground (text) color for normal (unselected) items.
-sb color
Sets the background color for selected items.
-sf color
Sets the foreground (text) color for selected items.
-w windowid
Uses the window with the given windowid as its parent, appearing within that window.
DESCRIPTION
dmenu is a highly efficient and minimalist application launcher and text filter for the X Window System. Developed as part of the Suckless project, it adheres to the philosophy of simplicity, clarity, and frugality. When launched, dmenu reads lines of text from standard input (stdin) and displays them in a customizable menu. Users can then type to filter the displayed items dynamically; as input is provided, dmenu narrows down the list of choices, highlighting matching entries.
Once an item is selected (typically by pressing Enter), the chosen item is printed to standard output (stdout). Its power lies in its ability to be easily integrated into shell scripts and other tools, acting as a powerful front-end for various tasks beyond just launching applications, such as selecting files, managing windows, or switching workspaces. Its keyboard-driven interface makes it fast and ideal for power users who prefer a streamlined, command-line centric workflow.
CAVEATS
dmenu primarily relies on compile-time configuration via its config.h file for advanced features and default settings, limiting runtime customization options compared to more feature-rich alternatives. It is also designed specifically for the X Window System and is not directly usable in a pure console environment.
CUSTOMIZATION VIA CONFIG.H
Unlike many applications that offer extensive runtime configuration, dmenu encourages users to modify its config.h source file and recompile it to change default behaviors, keybindings, and other advanced settings. This approach allows for deep customization while maintaining a small and efficient binary.
PIPING INPUT
One of dmenu's most powerful features is its ability to read input from standard input (stdin). This allows it to be seamlessly integrated into shell scripts to select from lists generated by other commands. For example, ls /usr/bin | dmenu -l 20 can be used to select an executable, or ps aux | dmenu -l 10 to select a process for management.
HISTORY
dmenu originated from the Suckless project, an initiative focused on developing minimalist, secure, and resource-efficient software. It was initially designed as a simple, keyboard-driven application launcher for dwm (dynamic window manager), another cornerstone project by Suckless. Its development emphasized simplicity, clarity, and the Unix philosophy of doing one thing well, making it highly extensible through shell scripting rather than baking many features directly into the core program.