From 1c3faf7b8a1258fab01f2eff897ba76c49711c02 Mon Sep 17 00:00:00 2001 From: punkfairie <23287005+punkfairie@users.noreply.github.com> Date: Sun, 28 Jul 2024 17:54:36 -0700 Subject: [PATCH] Update .config/polybar/scripts/powermenu.sh --- .../polybar/scripts/executable_powermenu.sh | 112 +++++++++--------- 1 file changed, 54 insertions(+), 58 deletions(-) diff --git a/dot_config/polybar/scripts/executable_powermenu.sh b/dot_config/polybar/scripts/executable_powermenu.sh index b46c6a3..f728485 100644 --- a/dot_config/polybar/scripts/executable_powermenu.sh +++ b/dot_config/polybar/scripts/executable_powermenu.sh @@ -5,7 +5,7 @@ ## Github : @adi1090x ## Twitter : @adi1090x -dir="~/.config/polybar/mytheme/scripts/rofi" +dir="$HOME/.config/polybar/scripts/rofi" uptime=$(uptime -p | sed -e 's/up //g') rofi_command="rofi -no-config -theme $dir/powermenu.rasi" @@ -19,11 +19,7 @@ logout=" Logout" # Confirmation confirm_exit() { - rofi -dmenu\ - -no-config\ - -i\ - -no-fixed-num-lines\ - -p "Are You Sure? : "\ + rofi -dmenu -no-config -i -no-fixed-num-lines -p "Are You Sure? : " \ -theme $dir/confirm.rasi } @@ -37,57 +33,57 @@ options="$lock\n$suspend\n$logout\n$reboot\n$shutdown" chosen="$(echo -e "$options" | $rofi_command -p "Uptime: $uptime" -dmenu -selected-row 0)" case $chosen in - $shutdown) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - systemctl poweroff - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; - $reboot) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - systemctl reboot - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; - $lock) - if [[ -f /usr/bin/betterlockscreen ]]; then - betterlockscreen -l +$shutdown) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + systemctl poweroff + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; +$reboot) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + systemctl reboot + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; +$lock) + if [[ -f /usr/bin/betterlockscreen ]]; then + betterlockscreen -l + fi + ;; +$suspend) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + mpc -q pause + amixer set Master mute + systemctl suspend + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; +$logout) + ans=$(confirm_exit &) + if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then + if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then + openbox --exit + elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then + bspc quit + elif [[ "$DESKTOP_SESSION" == "i3" ]]; then + i3-msg exit fi - ;; - $suspend) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - mpc -q pause - amixer set Master mute - systemctl suspend - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; - $logout) - ans=$(confirm_exit &) - if [[ $ans == "yes" || $ans == "YES" || $ans == "y" || $ans == "Y" ]]; then - if [[ "$DESKTOP_SESSION" == "Openbox" ]]; then - openbox --exit - elif [[ "$DESKTOP_SESSION" == "bspwm" ]]; then - bspc quit - elif [[ "$DESKTOP_SESSION" == "i3" ]]; then - i3-msg exit - fi - elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then - exit 0 - else - msg - fi - ;; + elif [[ $ans == "no" || $ans == "NO" || $ans == "n" || $ans == "N" ]]; then + exit 0 + else + msg + fi + ;; esac