From 1e267c52240e177f635f8f718099571e24493088 Mon Sep 17 00:00:00 2001 From: Justine Smithies Date: Tue, 17 Dec 2024 18:37:56 +0000 Subject: Converted from bash to sh. --- .local/bin/powermenu.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 .local/bin/powermenu.sh (limited to '.local/bin/powermenu.sh') diff --git a/.local/bin/powermenu.sh b/.local/bin/powermenu.sh new file mode 100755 index 0000000..8d353c2 --- /dev/null +++ b/.local/bin/powermenu.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +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") + doas poweroff + ;; + "$reboot") + doas reboot + ;; + "$suspend") + # $lock && loginctl suspend + ;; + "$hibernate") + # $lock && loginctl hibernate + ;; + "$log_out") + riverctl exit + ;; +esac -- cgit v1.2.3