rofi-dmenu5
Rofi dmenu emulation
Overview
To integrate rofi into scripts as simple selection dialogs, rofi supports emulating dmenu(1) (A dynamic menu for X11).
The website for dmenu can be found here ⟨http://tools.suckless.org/dmenu/⟩\c .
rofi does not aim to be 100% compatible with dmenu. There are simply too many flavors of dmenu. The idea is that the basic usage command-line flags are obeyed, theme-related flags are not. Besides, rofi offers some extended features (like multi-select, highlighting, message bar, extra key bindings).
Basic concept
In dmenu mode, rofi reads data from standard in, splits them into separate entries and displays them. If the user selects a row, this is printed out to standard out, allowing the script to process it further.
By default separation of rows is done on new lines, making it easy to pipe the output a one application into rofi and the output of rofi into the next.
Usage
By launching rofi with the -dmenu flag it will go into dmenu emulation mode.
-
ls | rofi -dmenu
Dmenu drop-in replacement
If argv[0] (calling command) is dmenu, rofi will start in dmenu mode. This way, it can be used as a drop-in replacement for dmenu. Just copy or symlink rofi to dmenu in $PATH.
-
ln -s /usr/bin/rofi /usr/bin/dmenu
Dmenu VS script mode
Script mode is used to extend rofi, dmenu mode is used to extend a script. The two do share much of the same input format. Please see the rofi-script(5) manpage for more information.
Dmenu specific commandline flags
A lot of these options can also be modified by the script using special input. See the rofi-script(5) manpage for more information about this syntax.
-sepseparator-
Separator for
dmenu. Example: To show a list of `a' to `e' with `|' as a separator:-
echo "a|b|c|d|e" | rofi -sep '|' -dmenu
-
-pprompt-
Specify the prompt to show in
dmenumode. For example, select `monkey', a,b,c,d, or e.-
echo "a|b|c|d|e" | rofi -sep '|' -dmenu -p "monkey"
Default: dmenu
-
-lnumber of lines to show-
Maximum number of lines the menu may show before scrolling.
-
rofi -dmenu -l 25
Default: 15
-
-i-
Makes
dmenusearches case-insensitive
-aX-
Active row, mark X as active. Where X is a comma-separated list of python(1)-style indices and ranges, e.g. indices start at 0, -1 refers to the last row with -2 preceding it, ranges are left-open and right-close, and so on. You can specify:
- •
-
A single row: `5'
- •
-
A range of (last 3) rows: `-3:'
- •
-
4 rows starting from row 7: `7:11' (or in legacy notation: `7-10')
- •
-
A set of rows: `2,0,-9'
- •
-
Or any combination: `5,-3:,7:11,2,0,-9'
-uX-
Urgent row, mark X as urgent. See
-aoption for details.
-only-match-
Only return a selected item, do not allow custom entry. This mode always returns an entry. It will not return if no matching entry is selected.
-no-custom-
Only return a selected item, do not allow custom entry. This mode returns directly when no entries given.
-formatformat-
Allows the output of dmenu to be customized (N is the total number of input entries):
- •
-
`s' selected string
- •
-
`i' index (0 - (N-1))
- •
-
`d' index (1 - N)
- •
-
`q' quote string
- •
-
`p' Selected string stripped from Pango markup (Needs to be a valid string)
- •
-
`f' filter string (user input)
- •
-
`F' quoted filter string (user input)
Default: `s'
-selectstring-
Select first line that matches the given string
-mesgstring-
Add a message line below the filter entry box. Supports Pango markup. For more information on supported markup, see here ⟨https://docs.gtk.org/Pango/pango_markup.html⟩\c
-dump-
Dump the filtered list to stdout and quit. This can be used to get the list as
rofiwould filter it. Use together with-filtercommand.
-inputfile-
Reads from file instead of stdin.
-password-
Hide the input text. This should not be considered secure!
-markup-rows-
Tell
rofithat DMenu input is Pango markup encoded, and should be rendered. See here ⟨https://docs.gtk.org/Pango/pango_markup.html⟩\c for details about Pango markup.
-multi-select-
Allow multiple lines to be selected. Adds a small selection indicator to the left of each entry.
-sync-
Force
rofimode to first read all data from stdin before showing the selection window. This is original dmenu behavior.Note: the default asynchronous mode will also be automatically disabled if used with conflicting options, such as
-dump,-only-matchor-auto-select.
-window-titletitle-
Set name used for the window title. Will be shown as Rofi - title
-wwindowid-
Position
rofiover the window with the given X11 window ID.
-keep-right-
Set ellipsize mode to start. So, the end of the string is visible.
-display-columns-
A comma seperated list of columns to show.
-display-column-separator-
The column separator. This is a regex.
default: ’
-ballot-selected-strstring-
When multi-select is enabled, prefix this string when element is selected.
default: “☑”
-ballot-unselected-strstring-
When multi-select is enabled, prefix this string when element is not selected.
default: “☐”
-ellipsize-mode(start|middle|end)-
Set ellipsize mode on the listview.
default “end”
Options
Extra options for individual rows can be also set. See the rofi-script(5) manpage for details; the syntax and supported features are identical.
Return value
•
|
|
|---|---|
•
|
|
•
|
|
Releases
3 releases since Debian 12 (Bookworm); the text changed 2 times.