summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2026-06-21 19:55:08 +0100
committerDavid T. Sadler <davidtsadler@googlemail.com>2026-06-21 19:55:08 +0100
commitf688a44171dc070c3c877b281bfb6752be883318 (patch)
treeb179742fe18167163fe56a04fcd0343b01a95e08
parentaebda32c2a09fcbdc1e645f55a0c6de3b9a2cfaf (diff)
Add power management script
-rwxr-xr-xbin/.bin/power.sh22
-rw-r--r--oxwm/.config/oxwm/config.lua5
2 files changed, 27 insertions, 0 deletions
diff --git a/bin/.bin/power.sh b/bin/.bin/power.sh
new file mode 100755
index 0000000..e17bae3
--- /dev/null
+++ b/bin/.bin/power.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+declare -A actions
+actions[Reboot]="systemctl reboot"
+actions[Shutdown]="systemctl poweroff"
+
+SELECTION=$(printf "Reboot\nShutdown" | rofi -dmenu -p "")
+
+if [ -z "$SELECTION" ]; then
+ exit 0
+fi
+
+if [ -z "${actions[$SELECTION]:-}" ]; then
+ notify-send "ERROR" "Invalid choice: $SELECTION"
+ exit 1
+fi
+
+notify-send "System" "Initiating $SELECTION..."
+sleep 0.5
+
+${actions[$SELECTION]}
diff --git a/oxwm/.config/oxwm/config.lua b/oxwm/.config/oxwm/config.lua
index 80b6d27..67e037a 100644
--- a/oxwm/.config/oxwm/config.lua
+++ b/oxwm/.config/oxwm/config.lua
@@ -288,6 +288,11 @@ oxwm.key.chord({
{ {}, "o" }
}, oxwm.spawn({ "open-bookmark.sh" }))
+oxwm.key.chord({
+ { { modkey }, "Space" },
+ { {}, "p" }
+}, oxwm.spawn({ "power.sh" }))
+
-------------------------------------------------------------------------------
-- Autostart
-------------------------------------------------------------------------------