aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/sway/executable_power-menu.sh
diff options
context:
space:
mode:
Diffstat (limited to 'dot_config/sway/executable_power-menu.sh')
-rw-r--r--dot_config/sway/executable_power-menu.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/dot_config/sway/executable_power-menu.sh b/dot_config/sway/executable_power-menu.sh
new file mode 100644
index 0000000..4aebcf6
--- /dev/null
+++ b/dot_config/sway/executable_power-menu.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Keyboard-driven power menu via fuzzel --dmenu.
+set -eu
+
+choice=$(printf '%s\n' \
+ " Lock" \
+ " Suspend" \
+ " Logout" \
+ " Reboot" \
+ " Poweroff" \
+ | fuzzel --dmenu --prompt='power: ' --lines=5 --width=20)
+
+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 sudo /usr/bin/reboot ;;
+ *Poweroff) exec sudo /usr/bin/poweroff ;;
+esac