README.md | ||
xfce4sspm.sh | ||
xfce4sspm_start.desktop | ||
xfce4sspm_stop.desktop |
What is this?
xfce4sspm.sh is a very simple POSIX shell script that, while running, stops any screensaver that xfce4-screensaver is running, if the monitor is not on.
Why this?
Because, unlike good old xscreensaver, when the monitor is not on xfce4-screensaver does not stop the running screensaver, and does not stop running other screensavers when in “Random” mode; which is a waste of power (possibly coming from a battery) and CPU/GPU cycles (some screensavers are very CPU intensive).
Why not use good old xscreensaver then?
Because many OpenGL screensavers show tearing, with it, at least under XFCE, at least on my 3 PCs (a desktop and two notebooks), both with Nvidia and Intel drivers, both with xfwm VSync on and off (i wrote to xscreensaver’s developer but he got angry and didn’t bother to try to fix this).
Why not file a feature request to xfce4-screensaver and-or xfce4-power-manager maintainers then?
I did, but the maintainer (who maintains both) got angry because i filed a bug report in both xfce4-screensaver and xfce4-power-manager; i’ll probably try again, soon or later, filing a feature request for xfce4-screensaver only.
How does this work?
While running, every 5 seconds, xfce4sspm.sh checks if the monitor is on using xset
(xorg-xset
package, in Arch official repos); if it’s not, it also checks if a screensaver is active using xfce4-screensaver-command
, and if it is, it issues a “deactivate” and an “inhibit” command, again using xfce4-screensaver-command
, and kills it when the monitor gets back on. It’s not elegant, but it’s quite light, and it’s the only way i could find out to do it.
How could i use it?
You could copy it into /usr/local/bin
, or any other directory, and make it automatically start on XFCE login and stop on XFCE logout with an “on login” entry starting it and an “on logout” entry killing it in XFCE “Session and Startup” preferences, under the “Application Autostart” tab (or just copy the two provided .desktop
files into your home “XDG autostart” directory, usually ~/.config/autostart
, and maybe edit the “Exec” line in xfce4sspm_start.desktop
according to where you placed the script, if it was not /usr/local/bin
).