XScreenSaver

From ArchWiki
(Redirected from Xscreensaver (Español))

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 X resources.

Theming

Starting from version 6.0, XScreenSaver comes with several pre-installed themes. You can select a theme using xscreensaver-settings or by changing the dialogTheme option (dialogTheme: themename in ~/.xscreensaver or using X resources: xscreensaver-auth.dialogTheme: themename).

You can customize themes using X resources. The example below demonstrates changing some colors and fonts. If you are using a non-default theme, replace default with the name of your chosen theme in lower case, or use question mark (?) to affect all themes:

~/.Xresources
! Font for regular texts.
! Font names are case-insensitive.
! You can use a comma-separated list of fonts to set a fallback font.
xscreensaver-auth.default.Dialog.bodyFont: times new roman 12, dejavu serif 12

! Window background color. You can use color names.
xscreensaver-auth.default.Dialog.background: black

! Main text color. You can also use HEX color codes.
xscreensaver-auth.default.Dialog.foreground: #ffffff

You can view a list of the available X resources in /usr/share/X11/app-defaults/XScreenSaver.

Do not forget to reload the resource file after changes.

DPMS and blanking settings

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: "overrides DPMS" is vague—xscreensaver does the equivalent of xset s 0 0, uses its own timer for the various animations, but sets the DPMS timeout to the values in Display Power Management. (Discuss in Talk:XScreenSaver)

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.

Note: If Lock Screen After in xscreensaver-demo is ticked and set to 0 minutes, the screen will be locked immediately upon blanking. If Power Manager Enabled is unticked, DPMS is disabled; it does not mean that XScreenSaver will relinquish control of DPMS settings.

Usage

Tip: To start XScreenSaver without the splash screen, use the --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.

In KDE Plasma, screen saver and locker features are handled by ksmserver, which conflicts with XScreenSaver. To disable it, you need to enable systemd startup for KDE and then edit the plasma-ksmserver.service user unit:

~/.config/systemd/user/plasma-ksmserver.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/ksmserver --no-lockscreen

Then logout and login again, and XScreenSaver should work properly now. See xscreensaver(1) § INSTALLING XSCREENSAVER ON KDE for more information.

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

XScreenSaver ships with a small utility named xscreensaver-systemd, which handles the PrepareForSleep signal from systemd using D-Bus and automatically locks the screen on suspend and hibernate. It is started automatically with xscreensaver, no further action required. See xscreensaver-systemd(6) for more information.

However, it does not handle other systemd signals such as loginctl lock-session. To handle it, you can use xss-lock. Use the --ignore-sleep option because the suspend/hibernate events are already handled by xscreensaver-systemd.

$ xss-lock --ignore-sleep -- xscreensaver-command -lock

You may want to set XScreenSaver's fade out time to 0.

User switching from the lock screen

Warning: When switching users using a display manager such as GDM or LightDM, XScreenSaver will not lock the original session—it can be accessed without a password simply by switching TTYs to the session in question. If you are using LightDM, as a workaround, install light-locker and run it alongside XScreenSaver. Alternatively, use a different screen locking program altogether—see List of applications/Security#Screen lockers.

By default, XScreenSaver's New Login button in the lock screen will call gdmflexiserver -ls to switch users. Display managers other than GDM that support user switching require a different command.

Tip: Adding xscreensaver-auth.default.*.newLoginCommand: to ~/.Xresources whilst leaving the argument blank will make the New Login button disappear.

As modifications in ~/.xscreensaver are discarded by xscreensaver-settings, ~/.Xresources is used in this section.

LXDM

To use LXDM's switching mode:

xscreensaver-auth.default.*.newLoginCommand: lxdm -c USER_SWITCH

LightDM

To use LightDM's switching mode:

xscreensaver-auth.default.*.newLoginCommand: dm-tool switch-to-greeter
Note: If you use this to switch to an already-logged-in user, you might have to enter the password twice (once for LightDM, and once for the XScreenSaver dialog of the user you logged in to).

SDDM

SDDM does not support user switching. [1] You can try to call the SwitchToGreeter method using dbus-send, but it may not work properly.

Tips and tricks

Disable during media playback

Starting from version 5.45, the xscreensaver-systemd utility implements the D-Bus ScreenSaver interface. It is started automatically with xscreensaver, so most applications should properly disable the screensaver without additional configuration. However, some applications do not support D-Bus or use another interfaces.

mpv

By default mpv uses the X11 Screen Saver extension (XSS). It 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.

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

Most browsers (Chromium and Chromium-based spin-offs, Firefox, GNOME Web, Otter Browser etc.) support the D-Bus ScreenSaver interface and should disable the screensaver during HTML5 video playback.

Other applications

If you are using applications that do not disable the screensaver, you can try a script named lightsonplus, which disables the screensaver when a fullscreen video is detected. Some applications (such as totem, Steam and others) are supported out of the box, you just need to enable their detection in the lightson+ script. If your application is unsupported but has a permanent window name, you can set it in the window_name variable.

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 &
Note: If xcompmgr or picom causes problems, install the shantz-xwinwrap-bzrAUR package, and run:
$ xwinwrap -b -fs -sp -nf -ov -- /usr/lib/xscreensaver/glslideshow -root -window-id WID &

Troubleshooting

To log verbose debugging information, start xscreensaver with the --verbose command line option. You can also add verbose: True to the ~/.xscreensaver file to make it persistent.

To save the log to a file, you can set the path using the --log option. Using this option also implies verbose output. (There is no equivalent option in ~/.xscreensaver or X resources).

See also