Jorisvandijk.com

Living on Linux

Jofi

Jofi

Any self-respecting Linux window manager user, uses either dmenu or Rofi to launch applications. Either is a simple program that will pop up with a keybinding and will allow the user to scroll through or search a list of programs installed on the system in order to launch them. It is in essence an application launcher.

I have used Rofi for years. It has worked great and I'd recommend it to anyone, however on my new Linux install I decided to tone down on applications as much as I could... Rofi was cut. I realized I could get the same functionality I had from Rofi with a simple one-line bash script and the terminal I already had installed, Kitty in my case.

The following is that one-line script that is now my application launcher:

#!/usr/bin/env bash

# Jofi 1.1
# Application launcher based on FZF.
# Dependencies: fzf, compgen
#
# By Joris van Dijk | Jorisvandijk.com
# Licensed under the GNU General Public License v3.0

compgen -c | fzf | (nohup ${SHELL:-"/bin/sh"} >/dev/null 2>&1 &)

What this does is run compgen to get a list of all applications installed on the system. It then pipe this through FZF so we can search this list with ease. When we select an option from this list it will then launch that option and any error will go to /dev/null, meaning we do not see it. Obviously you'd need to have FZF installed.

In my SXHKD I add the following to run this script with a keybinding:

super space
kitty --class float -e bin/Jofi

I found out you do not need to add a "+" between keys in SXHKD, so I forgo them now. At any rate, when I press super, or the Windows button, along with the space bar, it launches Kitty, my terminal emulator with the "Jofi" script. Jofi is the name I gave the script above (like Rofi, but by me Joris. Jofi. A silly name, I am aware.) Anyway I add the float class to this in order to get the terminal to float. This is done by adding the following to the bspwmrc file:

bspc rule -a float state=floating rectangle=800x600+880+500

This will make a terminal with the float class a floating terminal with a size of 800x600 in the center of my screen. If you intend to use this, you'd need to recalculate the center of your screen..

This new terminal will allow me to search any installed application and launch it by selecting it. It is in essence an application launcher.

Please try this on your own system and let me know if it works for you.