Create a gist now

Instantly share code, notes, and snippets.

@phpmoli /
Last active Aug 23, 2016

What would you like to do?
stop running screen saver when playing full screen video or tab in a chrome browser
#run from kde system settings/system administration/startup and shutdown/autostart/add script
while true ; do
id="$(DISPLAY=:0.0 xprop -root _NET_ACTIVE_WINDOW)"
if DISPLAY=:0.0 xprop -id "$id" | grep -F '_NET_WM_STATE_FULLSCREEN' >/dev/null && DISPLAY=:0.0 xprop -id "$id" | grep -E 'WM_CLASS\(STRING\) = ("google\-chrome", "google-chrome"|"Navigator", "Iceweasel"|"plugin\-container", "Plugin\-container")' >/dev/null ; then
if which qdbus >/dev/null ; then
qdbus org.freedesktop.ScreenSaver /ScreenSaver SimulateUserActivity >/dev/null
qdbus org.kde.ksmserver /ScreenSaver SimulateUserActivity >/dev/null
if which xscreensaver-command >/dev/null ; then xscreensaver-command -deactivate >/dev/null ; fi
if xset -q | grep -F 'DPMS is Enabled' >/dev/null ; then
xset -dpms
xset dpms
sleep 50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment