feat(script): remove redundant session checks and fix bug with polybar + pipewire after suspend

This commit is contained in:
doryan 2024-10-04 00:56:28 +04:00
parent 48f391908a
commit f80fa0607b

View File

@ -63,17 +63,9 @@ run_cmd() {
elif [[ $1 == '--reboot' ]]; then elif [[ $1 == '--reboot' ]]; then
loginctl reboot loginctl reboot
elif [[ $1 == '--suspend' ]]; then elif [[ $1 == '--suspend' ]]; then
loginctl suspend && betterlockscreen -l blur loginctl suspend
elif [[ $1 == '--logout' ]]; then elif [[ $1 == '--logout' ]]; then
if [[ "$DESKTOP_SESSION" == 'openbox' ]]; then bspc quit & pkill pipewire & pkill pipewire-pulse & pkill polybar
openbox --exit
elif [[ "$DESKTOP_SESSION" == 'bspwm' ]]; then
bspc quit
elif [[ "$DESKTOP_SESSION" == 'i3' ]]; then
i3-msg exit
elif [[ "$DESKTOP_SESSION" == 'plasma' ]]; then
qdbus org.kde.ksmserver /KSMServer logout 0 0 0
fi
fi fi
else else
exit 0 exit 0
@ -98,8 +90,9 @@ case ${chosen} in
;; ;;
$suspend) $suspend)
run_cmd --suspend run_cmd --suspend
betterlockscreen -l blur
;; ;;
$logout) $logout)
run_cmd --logout & pkill pipewire & pkill pipewire-pulse run_cmd --logout
;; ;;
esac esac