BHK Code Vault

Using Rofi as menu manager

Rofi er a very useful search/launcher used in Linux, and its potential is even more when setting it up as a separate, static launcher. It can be called via a shortcut or simply by a special keypress combo. An example of the menu is as follows:

#!/bin/bash

# options to be displayed
option1="Logout"
option2="Reboot"
option3="Shutdown"
option4="Set mediafolders"

# options passed into variable
options="$option1\n$option2\n$option3\n$option4\n$option5\n$option6"

chosen="$(echo -e "$options" | rofi -location 3 -dmenu -p "Tools")"
case $chosen in
    $option1)
        qtile cmd-obj -o cmd -f shutdown & ;;
    $option2)
        systemctl reboot;;
    $option3)
        killall qtile & systemctl poweroff;;
    $option4)
        kitty --hold bash /home/bloc67/scripts/setfolders.sh;;
esac
#linux, #ssh