aboutsummaryrefslogblamecommitdiff
path: root/.local/bin/powermenu
blob: 30574bbfa80e60ade2ceb207cda3eb4c3828bb11 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
           















                                                                           

                                                                                                          

                 
                          

              
                        

               
                                  

                 
                                    





                                                       
#!/bin/bash

#### 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 ~/.cache/wallpaper --effect-blur 10x5 --clock --indicator --datestr "%a %d %b %Y"
	hyprlock
        ;;    
    "$power_off")
        systemctl poweroff
        ;;
    "$reboot")
        systemctl reboot
        ;;
    "$suspend")
        $lock && systemctl suspend
        ;;
    "$hibernate")
        $lock && systemctl hibernate
        ;;
    "$log_out")
        #swaymsg exit
        loginctl terminate-session "${XDG_SESSION_ID-}"
        ;;
esac