aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/sway/executable_power-menu.sh
blob: edb5949b50c09cd9f257de4f7346513bd6f8732d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Keyboard-driven power menu via wofi --dmenu (j/k navigation).
set -eu

choice=$(printf '%s\n' \
    "  Lock" \
    "  Suspend" \
    "  Logout" \
    "  Reboot" \
    "  Poweroff" \
    | wofi --dmenu --hide-search --prompt='power' \
        --style "$HOME/.config/wofi/style.css")

case "$choice" in
    *Lock)     playerctl -a pause; exec swaylock -f -e -c 000000 ;;
    *Suspend)  playerctl -a pause; exec systemctl suspend ;;
    *Logout)   exec swaymsg exit ;;
    *Reboot)   exec systemctl reboot ;;
    *Poweroff) exec systemctl poweroff ;;
esac