Rofi: The pitcher and fast menu that transforms your Linux experience

Introduction

In the Linux world, customization and speed are aspects that many users are constantly looking to improve. A fast and flexible launcher can make the difference between a fluid workflow and one full of interruptions. Rofi is a light tool that combines application launcher, window changer and customizable menu functions, all with minimal resource consumption.

What is Rofi?

Rofi is a selector that is invoked by a keyboard shortcut and presents a filtered list of elements. While the user writes, the list is reduced in real time, allowing to quickly find applications, commands, windows or any other input. Its interface is text-based, which makes it compatible with virtually any desktop environment or window manager.

Installation

Most of the distributions include Rofi in their official repositories. On Debian / Ubuntu based systems can be installed with:

  • sudo apt update
  • sudo apt install rofi

In Fedora:

  • sudo dnf install rofi

In Arch Linux and derivatives:

  • sudo pacman -S rofi

For those who prefer to compile from the source code, the project is available in GitHub and requires dependencies such as libxcb, xcb-util-wm and pango.

Basic use

Once installed, launching Rofi is as simple as running:

rofi -show run

to obtain a command launcher, or:

rofi -show drun

can also be used as a window changer with:

rofi -show windo w

The default to invoke Rofi is usually configured in the window manager. For example, i3 is added:

bindsym $mod + d exec rofi -show drun

This opens the application menu every time you press the Super + D. key

Basic configuration

Rofi reads its configuration from~/.config/rofi/config. A minimum file could contain:

rofi.font: Sans 10rofi.background-color: # 0000rofi.text-color: # FFFFFrofi.border-color: # 333333

These lines define the source, background color, text color and edge color. Modifying these values allows the appearance to be adapted to the desktop theme without the need to install external themes.

Topics and personalization

For a higher level of customization, Rofi supports complete themes stored in~/.config/rofi/themes/. A simple theme that only fits colors and sizes could be seen as follows:

* {background: # 2E3440; foreground: # D8DEE9; border: # 4C566A;} window {width: 30%; height: 40vh; border: 2; border-color: # 4C566A;}

Save this file asdark.themeand then invoke Rofi with:

rofi -show drun -theme dark

apply the chosen style. (Note: the modedrunis used to launch applications; the above example shows how to combine mode and theme.)

Advanced modes

In addition to modesrun, drunandwindow, Rofi includes several specialized modes:

  • ssh: list of hosts defined in~/.ssh/configto connect quickly.
  • calc: a small evaluator of mathematical expressions.
  • emoji: emoji selector with real-time search.
  • windowcd: change directory based on the active window.
  • combi: combines several modes in one view, allowing to change between them with tabs.

These modes are invoked by specifying the argument-showfor examplerofi -show ssh.

Integration with window managers

The real power of Rofi is revealed when combined with keyboard shortcuts in tiling window managers. In i3, in addition to the application launcher, a shortcut can be defined for the window changer:

bindsym $mod + Shift + d exec rofi -show windo w

In Sway (the Wayland composer compatible with i3) the syntax is identical. In bspwm, you can use:

super + d rofi -show drun

And in XFCE or GNOME, tools such asxbindkeysor the custom shortcut configuration to launch Rofi with the desired combination.

Scripts and custom modes

One of the most powerful features of Rofi is the ability to create your own modes through scripts. Just create an executable that prints lines in its standard output; each line will be treated as an input. For example, a script that lists the active Docker containers:

#! / bin / bashdock ps --format '{{.Names}}'

Save it as~/.local/share/rofi/docker.sh, make it executable and then add:

rofi -modi docker:~/ .local / share / rofi / docker.sh -show doctor

This will open a menu with the names of the containers and, when you select one, you can pass the value to another script by the argument-selected-row.

Tips and tricks

  • Use-filterto start the search with a predefined text.
  • Combine Rofi withxclipto copy the selection to the clipboard automatically.
  • Take advantage of the waycalcfor quick conversions without opening a graphic calculator.
  • Set a demon that keeps Rofi in memory to reduce boot time on systems with limited hardware.
  • Explore the theme gallery in the official wiki to find inspiration and download designs created by the community.

Performance and consumption of resources

Rofi is written in C and uses XCB or Wayland directly, making it extremely light. In a typical machine with 2 GB RAM, the process consumes less than 5 MB of memory and just a few milliseconds of CPU when starting. This makes it an ideal option even for old devices or container environments where it is intended to minimize the overhead.

Conclusion

Rofi combines simplicity, flexibility and power in a single package. Whether you need a quick application launcher, an efficient window changer or a platform to create custom scripts menus, Rofi adapts to almost any Linux workflow. Its low resource consumption and extensive tematization capacity makes it essential both for beginners who seek to improve their productivity and for advanced users who want to adjust every detail of their environment. If you have not yet tried it, we invite you to install it, set up a keyboard shortcut and discover why so many users consider it the final launcher of the Linux ecosystem.

This work is under aCreative Commons License Attribution 4.0 International for Francesc Roig francesc @ vivaldi.net.

EnglishenEnglishEnglish