-
-
Save vadimhite/9dfb866bb7501e4bd5c224f60168a91c to your computer and use it in GitHub Desktop.
systemd-sleep kwin hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Restart kwin on resume after suspend | |
case "${1}" in | |
post) | |
KWIN_PID=$(pidof kwin) | |
KWIN_X11_PID=$(pidof kwin_x11) | |
if [ -n "${KWIN_PID}" ] ; then | |
KWIN_USER=$(ps -o euser= "${KWIN_PID}") | |
su "${KWIN_USER}" -c "DISPLAY=:0 kwin --replace &" | |
echo "kwin was successfully restarted after waking up..." | |
elif [ -n "${KWIN_X11_PID}" ] ; then | |
KWIN_X11_USER=$(ps -o euser= "${KWIN_X11_PID}") | |
su "${KWIN_X11_USER}" -c "DISPLAY=:0 kwin_x11 --replace &" | |
echo "kwin_x11 was successfully restarted after waking up..." | |
else | |
echo "kwin/kwin_x11 is not running..." | |
exit 1 | |
fi | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment