helm/users/profiles/desktop/bin/powermenu
2022-03-22 21:07:26 +10:00

32 lines
739 B
Bash
Executable file

#!/usr/bin/env sh
rofi_command="rofi -theme theme/powermenu.rasi"
### Options ###
power_off="\tShutdown"
reboot="\tReboot"
lock="\tLock"
suspend="鈴\tSleep"
log_out="\tLogout"
# Variable passed to rofi
options="$power_off\n$reboot\n$lock\n$suspend\n$log_out"
case "$(echo -e "$options" | $rofi_command -dmenu -selected-row 2)" in
$power_off)
systemctl poweroff
;;
$reboot)
systemctl reboot
;;
$lock)
zzz # TODO doesn't do anything
;;
$suspend)
dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause
systemctl suspend
;;
$log_out)
bspc quit
;;
esac