This is the sixth in a series of several posts on how to do way more than you really need to with rofi. It’s a neat little tool that does so many cool things. I don’t have a set number of posts, and I don’t have a set goal. I just want to share something I find useful.

This post highlights several useful rofi options. I don’t try to script anything here, so it’s a fairly short read.

Assumptions

I’m running Fedora 27. Most of the instructions are based on that OS. This will translate fairly well to other RHEL derivatives. The Debian ecosystem should also work fairly well, albeit with totally different package names. This probably won’t work at all on Windows, and I have no intention of fixing that.

You’re going to need a newer version of rofi, >=1.4. I’m currently running this:

$ rofi -version
Version: 1.4.2-131-git-5c5665ef (next)

If you installed from source, you should be good to go.

Code

You can view the code related to this post under the post-06-useful-options-i tag.

combi

The combi modi is, depending on your perspective, very useful or very intimidating. It combines the options from everything in its list, making it easy to look at several things without leaving the window.

At the moment, I have mine set to everything I have enabled. A nice thing about rofi is that it’s very easy to swap out config on the fly, so I could quick run combi on a smaller set of of my modi.

$ rofi -show combi -combi-modi "drun,ssh"
as opposed to
$ rofi -dump-config | grep combi-modi:
combi-modi: "file_browser,top,myplugin,keys,drun,ssh,run,windowcd,window";

Cycling modi

Being able to switch between enabled modi makes rofi a very useful tool. Cycling should be on by default, but it never hurts to forcibly enable it.

$ sed \
--in-place='.bak' \
-E 's/^.*\scycle:.*$/\tcycle: true;/g' \
$XDG_USER_CONFIG_DIR/rofi/config.rasi
$ diff --color --unified=0 "$XDG_USER_CONFIG_DIR/rofi/config.rasi"{.bak,}
--- $XDG_USER_CONFIG_DIR/rofi/config.rasi.bak
+++ $XDG_USER_CONFIG_DIR/rofi/config.rasi
@@ -28 +28 @@
-/* cycle: true;*/
+ cycle: true;

The shortcuts are also useful to know.

$ rofi -dump-config | grep kb-mode
kb-mode-next: "Shift+Right,Control+Tab";
kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";

Another useful cycling option is sidebar-mode. By default, the main window gives no notification of its modi.

basic-config-without-sidebar

However, in sidebar-mode, rofi adds a modi bar that shows the active modi and lists other available modi in the current session. It also adds mouse interaction on top of the kb-mode-* shortcuts.

basic-config-with-sidebar

$ sed \
--in-place='.bak' \
-E 's/^.*\ssidebar-mode:.*$/\tsidebar-mode: true;/g' \
$XDG_USER_CONFIG_DIR/rofi/config.rasi
$ diff --color --unified=0 "$XDG_USER_CONFIG_DIR/rofi/config.rasi"{.bak,}
--- $XDG_USER_CONFIG_DIR/rofi/config.rasi.bak
+++ $XDG_USER_CONFIG_DIR/rofi/config.rasi
@@ -29 +29 @@
-/* sidebar-mode: false;*/
+ sidebar-mode: true;

It can get a bit cramped the more modi you enable. I don’t mind it while I’m learning everything, but I will eventually slim it down. YMMV.