One of the reasons that Xubuntu is great is that it comes with xscreensaver enabled by default. However, there’s a problem; xscreensaver will kick in when you’ve been idle long enough no matter what – even if you’re watching a video. This post details a script which stops xscreensaver starting when a full-screen window has focus.
In the past xscreensaver and caffeine were best of buddies; stopping the screensaver intruding while you watched something. However, recent builds of caffeine don’t play nice with non-gnome desktops out of the box. To counter the problem I’ve produced a script that will stop xscreensaver kicking in when a full-screen window is in the foreground:
The script should be downloaded into any folder you think is best. To start the script a command similar to the following should be used:
You should add this command to your session’s start up applications and next time you log in xscreensaver will be prevented from running while you have any full-screen windows in the foreground. This include full-screen flash and HTML5 videos, meaning xscreensaver won’t interrupt Youtube or Netflix if you’re watching them full-screen.
The script works by performing a check every 30 seconds to see if the window that currently has focus is set to be full screen (not just maximised). If so the script tells xscreensaver to restart its count of how long the user has been idle.
The script should be usable on other Linux platforms that can use bash scripts and xscreensaver.
Feel free to modify the script if you can think of any improvements.
If you’re interested in a version of the script that stops the screensaver when any window is set to be full screen (not just the one that has focus) see this post (useful for multiple monitors).