XScreenSaver
XScreenSaver is a screen saver and locker for the X Window System.
Installation
Install the xscreensaver package.
For an Arch Linux branded experience, install the xscreensaver-arch-logoAUR package.
Configuration
Most options are configured on a user-by-user basis by running xscreensaver-settings. xscreensaver-settings writes the chosen configuration to ~/.xscreensaver
, discarding any manual modifications to the file. Global options are defined in /usr/share/X11/app-defaults/XScreenSaver
.
Since at least XScreenSaver 5.22, there is another way to edit XScreenSaver's user configuration, using Xresources. This includes theming support. See [1] for the version 5.22 defaults.
DPMS and blanking settings
XScreenSaver manages screen blanking and display energy saving (DPMS) independently of X itself and overrides it. To configure the timings for blanking, standby, display poweroff and such, use xscreensaver-demo or edit the configuration file manually, e.g. ~/.xscreensaver
:
timeout: 1:00:00 cycle: 0:05:00 lock: False lockTimeout: 0:00:00 passwdTimeout: 0:00:30 fade: True unfade: False fadeSeconds: 0:00:03 fadeTicks: 20 dpmsEnabled: True dpmsStandby: 2:00:00 dpmsSuspend: 2:00:00 dpmsOff: 4:00:00
DPMS and screen blanking can be disabled by starting xscreensaver-demo and, for the Mode setting, choosing Disable Screen Saver.
Usage
-no-splash
switch. See xscreensaver(1) for a full list of options.In the Xfce, LXDE and LXQt environments, XScreenSaver is autostarted automatically if it is available - no further action is required. For other environments, see Autostarting.
To immediately trigger xscreensaver, if it is running, and lock the screen, execute the following command:
$ xscreensaver-command -lock
Lock on suspend
See Power management#xss-lock. You may want to set XScreenSaver's fade out time to 0.
User switching from the lock screen
By default, XScreenSaver's New Login button in the lock screen will call /usr/bin/gdmflexiserver
to switch users. Display managers other than GDM or KDM that support user switching (such as LightDM) require a different command.
~/.Xresources
whilst leaving the argument blank will make the New Login button disappear.As modifications in ~/.xscreensaver
are discarded by xscreensaver-demo, ~/.Xresources
is used in this section.
LXDM
To use LXDM's switching mode:
xscreensaver.newLoginCommand: lxdm -c USER_SWITCH
LightDM
To use LightDM's switching mode:
xscreensaver.newLoginCommand: dm-tool switch-to-greeter
Tips and tricks
Disable during media playback
mpv
By default mpv turns off the screensaver at startup and turns it on again on exit. The screensaver is always re-enabled when the player is paused. The option can be controlled in mpv's configuration file located in ~/.config/mpv/mpv.conf
:
stop-screensaver = "yes"
This is not supported on all video outputs or platforms. If you face some issues you might use a Lua script to manually disable the screensaver. Create a file at ~/.config/mpv/scripts/xscreensaver.lua
with the following contents:
local utils = require 'mp.utils' mp.add_periodic_timer(30, function() utils.subprocess({args={"xscreensaver-command", "-deactivate"}}) end)
The above script will call xscreensaver-command -deactivate
every 30 seconds. (Formerly you could use the heartbeat-cmd
configuration option, but that is no longer present in newer versions of mpv.)
mplayer
Add the following to ~/.mplayer/config
:
heartbeat-cmd="xscreensaver-command -deactivate >&- 2>&- &"
Kodi
Kodi has no native support to disable XScreenSaver (it uses its own screensaver). Install the kodi-prevent-xscreensaverAUR package as a workaround or try Kodi extension from https://sourceforge.net/projects/osscreensavermanager/.
Browser HTML5 video/Flash
There is no native way to disable XScreenSaver for Flash or HTML5 fullscreen video, but there is a script named lightsonplus with support for Firefox's Flash plugin, Chromium's Flash plugin, HTML5 fullscreen video in Firefox and Chromium, MPlayer, and VLC.
Another script based solution would be firefox-dpms-gitAUR which makes use of PulseAudio output detection of Firefox and thus also works in windowed mode (but not without audio playback).
Animated wallpaper
One can run xscreensaver
in the background, just like a wallpaper. First, kill any process that is controlling the background (the root window).
Then, locate the desired XScreenSaver executable (typically in /usr/lib/xscreensaver/
) and run it with the -root
flag, for example:
$ /usr/lib/xscreensaver/glslideshow -root &
$ xwinwrap -b -fs -sp -fs -nf -ov -- /usr/lib/xscreensaver/glslideshow -root -window-id WID &
Troubleshooting
You can configure xscreensaver to write to a log file by creating the logfile touch /var/log/xscreensaver.log
as the root user and then specifying its X resource logFile:
~/.Xresources
xscreensaver.logFile:/var/log/xscreensaver.log
To log verbose debugging information to the logFile as well start xscreensaver with the -verbose
command line option, or add this to ~/.Xresources
:
~/.Xresources
xscreensaver.logFile:/var/log/xscreensaver.log xscreensaver.verbose:true