Created
March 10, 2021 21:42
-
-
Save DomingoMontoya/9017ebe9b5b5a8a5064970f53614ec22 to your computer and use it in GitHub Desktop.
Script to have KDE autostart on login to restart compositor on crash (due to removing monitors or suspend/resume)
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/sh | |
while true; do | |
# Check if opengl marked as unsafe, set to safe, and restart kwin | |
if grep "OpenGLIsUnsafe=true" ~/.config/kwinrc ; then | |
sed -i "s/OpenGLIsUnsafe=true/OpenGLIsUnsafe=false/g" ~/.config/kwinrc | |
nohup kwin_x11 --replace & | |
fi | |
# Check if compositor is disabled, and enable by invoking shortcut to toggle it | |
if [ $(qdbus org.kde.KWin /Compositor active) == "false" ] ; then | |
qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Suspend Compositing" | |
fi | |
sleep 2s | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment