diff --git a/scripts/.local/bin/powermenu b/scripts/.local/bin/powermenu index 89362e0..b186399 100755 --- a/scripts/.local/bin/powermenu +++ b/scripts/.local/bin/powermenu @@ -58,12 +58,20 @@ result=$(printf "%s" "$menu" | $selector_program $selector_opts --prompt "$promp case "$result" in "Shutdown" | "$power_off_btn") if [ -n "$POWERMENU_SHUTDOWN_CMD" ]; then eval "$POWERMENU_SHUTDOWN_CMD"; else - systemctl poweroff + if [ -x /usr/bin/systemctl ]; then + systemctl poweroff + else + sudo poweroff + fi fi ;; "Reboot" | "$reboot_btn") if [ -n "$POWERMENU_REBOOT_CMD" ]; then eval "$POWERMENU_REBOOT_CMD"; else - systemctl reboot + if [ -x /usr/bin/systemctl ]; then + systemctl reboot + else + sudo reboot + fi fi ;; "Lockscreen" | "$lock_btn") @@ -81,12 +89,20 @@ case "$result" in ;; "Suspend" | "$suspend_btn") if [ -n "$POWERMENU_SUSPEND_CMD" ]; then eval "$POWERMENU_SUSPEND_CMD"; else - systemctl suspend-then-hibernate + if [ -x /usr/bin/systemctl ]; then + systemctl suspend-then-hibernate + else + sudo zzz -H + fi fi ;; "Hibernate" | "$hibernate_btn") if [ -n "$POWERMENU_HIBERNATE_CMD" ]; then eval "$POWERMENU_HIBERNATE_CMD"; else - systemctl hibernate + if [ -x /usr/bin/systemctl ]; then + systemctl hibernate + else + sudo ZZZ + fi fi ;; esac