summaryrefslogtreecommitdiff
path: root/bin/.bin/power.sh
diff options
context:
space:
mode:
authorDavid T. Sadler <davidtsadler@googlemail.com>2026-06-27 11:41:52 +0100
committerDavid T. Sadler <davidtsadler@googlemail.com>2026-06-27 11:41:52 +0100
commit36ee8ea0a3454820f105cd268840c7246fe2ef10 (patch)
tree04eae7b8ffc2e8b86bfc84c5e11275085ed932ab /bin/.bin/power.sh
parent63c8dad6d9da57bd9c8cfa19f9fdce99f3533d9e (diff)
parente1fc179e3de951b9705450ef911b0ee6a39ec0ee (diff)
Merge branch 'main' into howl
Diffstat (limited to 'bin/.bin/power.sh')
-rwxr-xr-xbin/.bin/power.sh22
1 files changed, 22 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]}