summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpower-menu31
1 files changed, 31 insertions, 0 deletions
diff --git a/power-menu b/power-menu
new file mode 100755
index 0000000..c615c43
--- /dev/null
+++ b/power-menu
@@ -0,0 +1,31 @@
+#!/bin/sh
+LIST="$(cat <<EOF
+shutdown
+reboot
+lock
+suspend
+hibernate
+logout
+EOF
+)"
+
+type systemctl >/dev/null && SYSTEMCTL="systemctl"
+SYSTEMCTL="${SYSTEMCTL:-loginctl}"
+
+COMMAND="$(echo "${LIST}" | dmenu -r)"
+
+case "${COMMAND}" in
+ "shutdown") ${SYSTEMCTL} poweroff ;;
+ "reboot")
+ ${SYSTEMCTL} reboot ;;
+ "lock") loginctl lock-session ;;
+ "suspend") ${SYSTEMCTL} suspend ;;
+ "hibernate") ${SYSTEMCTL} hibernate ;;
+ "logout")
+ if pgrep -x Hyprland; then
+ hyprctl dispatch exit
+ else
+ loginctl terminate-session
+ fi
+ ;;
+esac