aboutsummaryrefslogtreecommitdiff
path: root/.local/bin/powermenu
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2023-08-22 19:35:23 +0100
committerJustine Smithies <justine@smithies.me.uk>2023-08-22 19:35:23 +0100
commit3058d6df77817de298a207d36b8b0871893c417a (patch)
tree2f3cbb973751e0f829ad3e00dd52bc5a081936d5 /.local/bin/powermenu
parent1125d4a4ee25de42f3223d612a50a1256bd222d3 (diff)
Initial commit
Diffstat (limited to '.local/bin/powermenu')
-rwxr-xr-x.local/bin/powermenu39
1 files changed, 39 insertions, 0 deletions
diff --git a/.local/bin/powermenu b/.local/bin/powermenu
new file mode 100755
index 0000000..aeded37
--- /dev/null
+++ b/.local/bin/powermenu
@@ -0,0 +1,39 @@
+#!/bin/bash
+lock="swaylock -f -i ~/.cache/wallpaper"
+
+#lock="swaylock -f -i ~/.cache/wallpaper --effect-blur 10x5 --clock --indicator"
+
+#### 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")
+ $lock
+ ;;
+ "$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-}"
+ ;;
+esac