aboutsummaryrefslogblamecommitdiff
path: root/.local/bin/powermenu
blob: aeded379b4781bca131430ba03fa04e944dd782a (plain) (tree)






































                                                                                
#!/bin/bash
lock="swaylock -f -i ~/.cache/wallpaper"

#lock="swaylock -f -i ~/.cache/wallpaper --effect-blur 10x5 --clock --indicator"

#### Options ###
power_off=" Shutdown"
reboot="󰜉 Reboot"
lock_screen=" Lock Screen"
suspend=" Suspend"
hibernate="󰒲 Hibernate"
log_out="󰍃﫼 Log Out"

# Options passed to fuzzel
options="$power_off\n$reboot\n$suspend\n$hibernate\n$log_out\n$lock_screen"
lines="$(echo "$options" | grep -oF '\n' | wc -l)"
rofi_command="fuzzel -d -w 14 -l $((lines+1))"
chosen="$(echo -e "$options" | $rofi_command )"
case $chosen in
    "$lock_screen")
        $lock 
        ;;    
    "$power_off")
        loginctl poweroff
        ;;
    "$reboot")
        loginctl reboot
        ;;
    "$suspend")
        $lock && loginctl suspend
        ;;
    "$hibernate")
        $lock && loginctl hibernate
        ;;
    "$log_out")
        #swaymsg exit
        loginctl terminate-session "${XDG_SESSION_ID-}"
        ;;
esac