aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/power-menu.sh
blob: b884b177b21e41c54a3fa8dd50364b763ecd558e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

# Get current set wallpaper for the lockscreen option
read -r wallpaper<~/.cache/wallpaper

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

# Menu display order
options="$power_off\n$reboot\n$suspend\n$hibernate\n$log_out\n$lock_screen"

case "$@" in
    "$power_off")
        doas poweroff
        exit 0
        ;;
    "$reboot")
        doas reboot
        exit 0
        ;;
    "$suspend")
        $lock && zzz
        exit 0
        ;;
    "$hibernate")
        # $lock && WIP
        exit 0
        ;;
    "$log_out")
        swaymsg exit
        exit 0
        ;;
    "$lock_screen")
        swaylock -f -i "$wallpaper"
        exit 0
        ;;
esac

# Display all options in menu
echo -e "$options"