A very simple POSIX shell script that, while running, stops any screensaver that xfce4-screensaver is running, if the monitor is not on; it’s just a workaround for xfce4-screensaver not doing it by itself.
Find a file
2025-06-03 20:28:08 +02:00
README.md Fixed a typo 2025-06-03 20:09:02 +02:00
xfce4sspm.sh Added a “clean exit” function that gets executed on HUP INT and TERM signals ensuring screensaver deinhibition before exit; made monitor and screensaver status detection more flexible 2025-06-03 20:28:08 +02:00
xfce4sspm_start.desktop First commit 2025-06-03 18:05:28 +02:00
xfce4sspm_stop.desktop First commit 2025-06-03 18:05:28 +02:00

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 xscreensavers developer but he got angry and didnt 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; ill 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 its 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. Its not elegant, but its quite light, and its 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).