LinuxCommandLibrary

rofi

Launch applications and execute commands

TLDR

Show the list of apps

$ rofi -show drun
copy

Show the list of all commands
$ rofi -show run
copy

Switch between windows
$ rofi -show window
copy

Pipe a list of items to stdin and print the selected item to stdout
$ printf "[Choice1\nChoice2\nChoice3]" | rofi -dmenu
copy

SYNOPSIS

rofi [options]
rofi -show mode [options]

PARAMETERS

-show mode
    Specifies the mode to display immediately upon startup. Common modes include run (execute commands), drun (launch desktop applications), window (switch windows), and ssh (SSH launcher).

-modi mode1,mode2
    Defines an ordered, comma-separated list of modes to enable. Users can switch between these modes within rofi.

-theme file
    Loads a specific theme from a CSS-like file, overriding the default or configured theme.

-font font_description
    Sets the font to be used in rofi, e.g., 'monospace 12'.

-show-icons
    Displays icons for applications (e.g., in drun mode) if available in the desktop entry.

-monitor id
    Specifies which monitor rofi should appear on, identified by its numerical ID or 'all'.

-width percentage|value
    Sets the width of the rofi window as a percentage of the screen width (e.g., '50%') or a fixed pixel value (e.g., '500').

-opacity percentage
    Sets the opacity level of the rofi window, from 0 (fully transparent) to 100 (fully opaque).

-matching method
    Defines the matching algorithm for filtering results. Common methods are normal (substring), fuzzy, and prefix.

-p prompt
    Sets the prompt text displayed at the input line, e.g., 'Run Command:'.

-i
    Enables case-insensitive matching for input filtering.

-case-sensitive
    Forces case-sensitive matching, overriding any default or -i option.

-drun-show-actions
    In drun mode, shows additional actions defined in desktop entries (e.g., 'Open New Window').

-fullscreen
    Makes the rofi window take up the entire screen.

-version
    Prints the rofi version information and exits.

DESCRIPTION

rofi is a dynamic, keyboard-driven application launcher, window switcher, and SSH menu. It's a highly configurable tool designed to replace dmenu and provide a more interactive and visually appealing interface. Users can navigate through choices using arrow keys or by typing to filter entries. Its modular design allows for various modes, including searching for applications, switching between open windows, browsing SSH hosts, and running arbitrary commands.

rofi supports themes, custom scripts, and offers extensive customization options via command-line arguments and configuration files, making it a versatile productivity booster for tiling window managers and desktop environments alike. It's written in C, focuses on speed, and integrates well with X11.

CAVEATS

rofi is primarily designed for X11 environments. While it can run on Wayland via XWayland, native Wayland support is not fully implemented, which might limit some features (like window switching) or introduce compatibility issues.

Custom theming, while powerful, can have a steep learning curve due to its CSS-like syntax. Performance might degrade with extremely large input lists or overly complex themes.

CONFIGURATION FILES

rofi can be configured globally via a configuration file, typically located at ~/.config/rofi/config.rasi (for the new Xresources-like format) or ~/.config/rofi/config (for the older key-value format). These files allow users to set default modes, themes, fonts, keybindings, and other behavioral aspects, preventing the need to specify them on the command line every time.

CUSTOM MODES & SCRIPTS

One of rofi's most powerful features is its support for custom modes via external scripts. Users can create executable scripts that output a list of items (one per line) to standard output. rofi will then display these items for selection. Upon selection, rofi will pass the chosen item back to the script's standard input. This mechanism enables users to extend rofi's functionality to manage almost any type of data or workflow.

HISTORY

rofi was originally developed by Rasmus Steinke as a more feature-rich and visually appealing alternative to dmenu. It started as a simple application launcher but quickly evolved to include a window switcher, SSH launcher, and other modes, driven by community demand for more interactive and customizable tools in tiling window manager setups (like i3, Awesome, and bspwm). Its focus on speed, extensive theming capabilities, and scriptability has led to its widespread adoption as a versatile productivity tool in the Linux desktop ecosystem.

SEE ALSO

dmenu(1), xfce4-appfinder(1), gmrun(1), ssh(1), xdotool(1)

Copied to clipboard