summaryrefslogtreecommitdiff
path: root/power-menu
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2025-07-31 23:12:22 -0500
committerzachir <zachir@librem.one>2025-07-31 23:12:22 -0500
commitea533c192b79a2b156c3c1af946e773d2a9da450 (patch)
treead55331c54cd01819b0e4da0e469395da2b53eef /power-menu
parent1994547bb7da4c09fbfe05adec45c5bea32af758 (diff)
Add basic dmenu power script
Diffstat (limited to 'power-menu')
-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