summaryrefslogtreecommitdiffstatshomepage
path: root/sway/.local/bin
diff options
context:
space:
mode:
Diffstat (limited to 'sway/.local/bin')
-rwxr-xr-xsway/.local/bin/powermenu32
1 files changed, 32 insertions, 0 deletions
diff --git a/sway/.local/bin/powermenu b/sway/.local/bin/powermenu
new file mode 100755
index 0000000..688ae3b
--- /dev/null
+++ b/sway/.local/bin/powermenu
@@ -0,0 +1,32 @@
+#!/usr/bin/sh
+
+if [ "$#" -eq 0 ]; then
+ set -- $(awk '{print tolower($2)}')
+fi
+
+case "$1" in
+lock)
+ loginctl lock-session ${XDG_SESSION_ID-}
+ ;;
+logout)
+ loginctl terminate-session ${XDG_SESSION_ID-}
+ ;;
+suspend)
+ systemctl suspend
+ ;;
+hibernate)
+ systemctl hibernate
+ ;;
+reboot)
+ systemctl reboot
+ ;;
+poweroff)
+ systemctl poweroff
+ ;;
+*list)
+ printf '%s\n' '󰌾 Lock' '󰍃 Logout' '󰋊 Hibernate' '󰒲 Suspend' '󰜉 Reboot' '󰐥 Poweroff'
+ ;;
+*)
+ echo "Invalid argument: $@"
+ ;;
+esac