diff options
| author | David Sadler <david@flashacademy.com> | 2026-07-07 09:15:46 +0100 |
|---|---|---|
| committer | David Sadler <david@flashacademy.com> | 2026-07-07 09:15:46 +0100 |
| commit | 626c119a60701e2908e5795b3941078ebb8dba6b (patch) | |
| tree | ad8b6577953f50ad958051ef1d2493e8785ad4cb /bin/.bin/power.sh | |
| parent | 4c8d52122d962a0194737450e825471f27c93451 (diff) | |
| parent | fc2b007057dc763de14f9cd7860360bc5c9b646e (diff) | |
Merge branch 'main' into WSL
Diffstat (limited to 'bin/.bin/power.sh')
| -rwxr-xr-x | bin/.bin/power.sh | 22 |
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]} |
