diff options
author | Justine Smithies <justine@smithies.me.uk> | 2024-11-08 20:43:20 +0000 |
---|---|---|
committer | Justine Smithies <justine@smithies.me.uk> | 2024-11-08 20:43:20 +0000 |
commit | 8d0bdf6bef075ea538f05759528e58bad166b924 (patch) | |
tree | fe823b1ef3ca8f041d37c480b0c99ae4393a48f8 /.local/bin/powermenu | |
parent | 47f3bc8e0a8784f849cce23c9dfa72d1ea1d22b0 (diff) |
Initial commit
Diffstat (limited to '.local/bin/powermenu')
-rwxr-xr-x | .local/bin/powermenu | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/.local/bin/powermenu b/.local/bin/powermenu new file mode 100755 index 0000000..31a8f8a --- /dev/null +++ b/.local/bin/powermenu @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +read -r wallpaper<~/.cache/wallpaper + +#### Options ### +power_off=" Shutdown" +reboot=" Reboot" +lock_screen=" Lock Screen" +suspend=" Suspend" +hibernate=" Hibernate" +log_out=" Log Out" + +# Options passed to fuzzel +options="$power_off\n$reboot\n$suspend\n$hibernate\n$log_out\n$lock_screen" +lines="$(echo "$options" | grep -oF '\n' | wc -l)" +rofi_command="fuzzel -d -w 14 -l $((lines+1))" +chosen="$(echo -e "$options" | $rofi_command )" +case $chosen in + "$lock_screen") + swaylock -f -i "$wallpaper" + ;; + "$power_off") + loginctl poweroff + ;; + "$reboot") + loginctl reboot + ;; + "$suspend") + $lock && loginctl suspend + ;; + "$hibernate") + $lock && loginctl hibernate + ;; + "$log_out") + #swaymsg exit + #loginctl terminate-session "${XDG_SESSION_ID-}" + riverctl exit + ;; +esac |