aboutsummaryrefslogblamecommitdiff
path: root/.local/bin/powermenu.sh
blob: 4f95d60eb92c59fc65486c5e1885462dc9548ddf (plain) (tree)
1
2
3
4
5
6
7
8
9
10
         








                                    
                      
 

                                  






                                                                           
                                   

                 
                     

              
                   

               
                    

                 
                      

               


                     
#!/bin/sh

read -r wallpaper<~/.cache/wallpaper

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

lock="swaylock -f -i "$wallpaper""

# 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 && zzz
        ;;
    "$hibernate")
        # $lock && WIP
        ;;
    "$log_out")
        riverctl exit
        ;;
esac