From f688a44171dc070c3c877b281bfb6752be883318 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Sun, 21 Jun 2026 19:55:08 +0100 Subject: Add power management script --- bin/.bin/power.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/.bin/power.sh (limited to 'bin') 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]} -- cgit v1.2.3-13-gbd6f