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





















                                                                           
                     

              
                   

               
                                   

                 
                                     

               


                     
#!/usr/bin/env bash

read -r wallpaper<~/.cache/wallpaper

#### 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")
	swaylock -f -i "$wallpaper"
        ;;    
    "$power_off")
        doas poweroff
        ;;
    "$reboot")
        doas reboot
        ;;
    "$suspend")
        # $lock && loginctl suspend
        ;;
    "$hibernate")
        # $lock && loginctl hibernate
        ;;
    "$log_out")
        riverctl exit
        ;;
esac