dotfiles/scripts/rofi.sh

55 lines
985 B
Bash
Raw Normal View History

2024-10-04 19:57:49 +00:00
#!/bin/bash
OPTIONS="Firefox\nTelegram\nNekobox\nSteam\nMultiMC\nQEMU\npavucontrol\nNetworkManager\nReboot\nShutdown"
CHOICE=$(echo -e "$OPTIONS" | rofi -dmenu \
-no-fixed-num-lines \
-p ">")
run_with_sudo() {
if [ -z "$SUDOPASS" ]; then
SUDOPASS=$(rofi -dmenu -password -no-fixed-num-lines -p ">")
fi
echo "$SUDOPASS" | sudo -S nohup "$1"
}
case "$CHOICE" in
Firefox)
firefox-esr
;;
Telegram)
telegram-desktop
;;
Nekobox)
run_with_sudo "nekoray"
;;
Steam)
steam
;;
MultiMC)
multimc
;;
QEMU)
virt-manager
;;
pavucontrol)
pavucontrol
;;
NetworkManager)
NetworkManager
;;
Reboot)
reboot
;;
Shutdown)
poweroff
;;
*)
if [[ $CHOICE == sudo* ]]; then
run_with_sudo "$CHOICE"
else
$CHOICE
fi
;;
esac