Section: XScreenSaver manual (1)
Updated: 5.30 (11-Sep-2014)
The xscreensaver program waits until the keyboard and mouse have been idle for a period, and then runs a graphics demo chosen at random. It turns off as soon as there is any mouse or keyboard activity.
This program can lock your terminal in order to prevent others from using it, though its default mode of operation is merely to display pretty pictures on your screen when it is not in use.
For the impatient, try this:
xscreensaver & xscreensaver-demo
Note that xscreensaver has a client-server model: the xscreensaver program is a daemon that runs in the background; it is controlled by the foreground xscreensaver-demo?(1) and xscreensaver-command?(1) programs.
The easiest way to configure xscreensaver is to simply run the xscreensaver-demo?(1) program, and change the settings through the GUI. The rest of this manual page describes lower level ways of changing settings.
I'll repeat that because it's important:
Options to xscreensaver are stored in one of two places: in a .xscreensaver file in your home directory; or in the X resource database. If the .xscreensaver file exists, it overrides any settings in the resource database.
The syntax of the .xscreensaver file is similar to that of the .Xdefaults file; for example, to set the timeout parameter in the .xscreensaver file, you would write the following:
whereas, in the .Xdefaults file, you would write
If you change a setting in the .xscreensaver file while xscreensaver is already running, it will notice this, and reload the file. (The file will be reloaded the next time the screen saver needs to take some action, such as blanking or unblanking the screen, or picking a new graphics mode.)
If you change a setting in your X resource database, or if you want xscreensaver to notice your changes immediately instead of the next time it wakes up, then you will need to reload your .Xdefaults file, and then tell the running xscreensaver process to restart itself, like so:
xrdb < ~/.Xdefaults xscreensaver-command -restart
If you want to set the system-wide defaults, then make your edits to the xscreensaver app-defaults file, which should have been installed when xscreensaver itself was installed. The app-defaults file will usually be named /usr/lib/X11/app-defaults/XScreenSaver, but different systems might keep it in a different place (for example, /usr/openwin/lib/app-defaults/XScreenSaver on Solaris.)
When settings are changed in the Preferences dialog box (see above) the current settings will be written to the .xscreensaver file. (The .Xdefaults file and the app-defaults file will never be written by xscreensaver itself.)
xscreensaver also accepts a few command-line options, mostly for use when debugging: for normal operation, you should configure things via the ~/.xscreensaver file.
When it is time to activate the screensaver, a full-screen black window is created on each screen of the display. Each window is created in such a way that, to any subsequently-created programs, it will appear to be a "virtual root" window. Because of this, any program which draws on the root window (and which understands virtual roots) can be used as a screensaver. The various graphics demos are, in fact, just standalone programs that know how to draw on the provided window.
When the user becomes active again, the screensaver windows are unmapped, and the running subprocesses are killed by sending them SIGTERM. This is also how the subprocesses are killed when the screensaver decides that it's time to run a different demo: the old one is killed and a new one is launched.
Modern X servers contain support to power down the monitor after an idle period. If the monitor has powered down, then xscreensaver will notice this (after a few minutes), and will not waste CPU by drawing graphics demos on a black screen. An attempt will also be made to explicitly power the monitor back up as soon as user activity is detected.
The ~/.xscreensaver file controls the configuration of your display's power management settings: if you have used xset?(1) to change your power management settings, then xscreensaver will override those changes with the values specified in ~/.xscreensaver (or with its built-in defaults, if there is no ~/.xscreensaver file yet.)
If the power management section is grayed out in the xscreensaver-demo?(1) window, then that means that your X server does not support the XDPMS extension, and so control over the monitor's power state is not available.
If you're using a laptop, don't be surprised if changing the DPMS settings has no effect: many laptops have monitor power-saving behavior built in at a very low level that is invisible to Unix and X. On such systems, you can typically adjust the power-saving delays only by changing settings in the BIOS in some hardware-specific way.
For the better part of a decade, GNOME shipped xscreensaver as-is, and everything just worked out of the box. In 2005, however, they decided to re-invent the wheel and ship their own replacement for the xscreensaver daemon called "gnome-screensaver", rather than improving xscreensaver and contributing their changes back. As a result, the "gnome-screensaver" program is insecure, bug-ridden, and missing many features of xscreensaver. You shouldn't use it.
To replace gnome-screensaver with xscreensaver:
sudo apt-get remove gnome-screensaver:
sudo ln -sf /usr/bin/xscreensaver-command \ /usr/bin/gnome-screensaver-command:
Like GNOME, KDE also decided to invent their own screen saver framework from scratch instead of simply using xscreensaver. To replace the KDE screen saver with xscreensaver, do the following:
[Desktop Entry] Exec=xscreensaver Name=XScreenSaver Type=Application X-KDE-StartupNotify=false:
#!/bin/sh xscreensaver-command -lock
Make sure the file is executable (chmod a+x).
Guess what, they did it again! Ubuntu Unity's screen-locking framework is yet another rewrite, and it is completely broken, bug-ridden and insecure. At this time I don't have any information on how to turn it off and use xscreensaver instead. If you do, let me know.
You can run xscreensaver from your gdm?(1) session, so that the screensaver will run even when nobody is logged in on the console. To do this, run gdmconfig?(1) and on the Background page, type the command "xscreensaver -nosplash" into the Background Program field. That will cause gdm to run xscreensaver while nobody is logged in, and kill it as soon as someone does log in. (The user will then be responsible for starting xscreensaver on their own, if they want.)
Another way to accomplish the same thing is to edit the file /etc/X11/gdm/gdm.conf to include:
BackgroundProgram=xscreensaver -nosplash RunBackgroundProgramAlways=true
In this situation, the xscreensaver process will probably be running as user gdm instead of root. You can configure the settings for this nobody-logged-in state (timeouts, DPMS, etc.) by editing the ~gdm/.xscreensaver file.
To get gdm to run the BackgroundProgram, you may need to switch it from the "Graphical Greeter" to the "Standard Greeter".
It is safe to run xscreensaver as root (as xdm or gdm may do.) If run as root, xscreensaver changes its effective user and group ids to something safe (like "nobody") before connecting to the X server or launching user-specified programs.
An unfortunate side effect of this (important) security precaution is that it may conflict with cookie-based authentication.
If you get "connection refused" errors when running xscreensaver from gdm, then this probably means that you have xauth?(1) or some other security mechanism turned on. For information on the X server's access control mechanisms, see the man pages for X?(1), Xsecurity?(1), xauth?(1), and xhost?(1).
Bugs? There are no bugs. Ok, well, maybe. If you find one, please let me know. http://www.jwz.org/xscreensaver/bugs.html explains how to construct the most useful bug reports.
An implication of this is that if you log in as root on the console, xscreensaver will refuse to lock the screen (because it can't tell the difference between root being logged in on the console, and a normal user being logged in on the console but xscreensaver having been launched by the xdm?(1) Xsetup file.)
The solution to this is simple: you shouldn't be logging in on the console as root in the first place! (What, are you crazy or something?)
You should be sure that this is an acceptable thing to do in your environment before doing it. See the "Using GDM" section, above, for more details.
If you change your password after xscreensaver has been launched, it will continue using your old password to unlock the screen until xscreensaver is restarted. On some systems, it may accept both your old and new passwords. So, after you change your password, you'll have to do
to make xscreensaver notice.
If the PAM configuration files do not know about xscreensaver, then you might be in a situation where xscreensaver will refuse to ever unlock the screen.
This is a design flaw in PAM (there is no way for a client to tell the difference between PAM responding "I have never heard of your module", and responding, "you typed the wrong password".) As far as I can tell, there is no way for xscreensaver to automatically work around this, or detect the problem in advance, so if you have PAM, make sure it is configured correctly!
Your options are: don't use the OpenGL display modes; or, collect the spare change hidden under the cushions of your couch, and use it to buy a video card manufactured after 1998. (It doesn't even need to be fast 3D hardware: the problem will be fixed if there is any 3D hardware at all.)
Unfortunately, there is no way for xscreensaver itself to override the interpretation of these keys. If you want to disable Ctrl+Alt+Backspace globally, you need to set the DontZap flag in your /etc/X11/XF86Config file. To globally disable VT switching, you can set the DontVTSwitch flag. See the XF86Config?(5) manual for details.
Legal values for the VisualID resource are:
This does nothing if you have a TrueColor (16-bit or deeper) display.
When the screensaver starts up, one of these is selected (according to the mode setting), and run. After the cycle period expires, it is killed, and another is selected and run.
If all programs are disabled, then the screen will just be made blank, as when mode is set to blank.
To disable a program, you must mark it as disabled with a dash instead of removing it from the list. This is because the system-wide (app-defaults) and per-user (.xscreensaver) settings are merged together, and if a user just deletes an entry from their programs list, but that entry still exists in the system-wide list, then it will come back. However, if the user disables it, then their setting takes precedence.
If the display has multiple screens, then a different program will be run for each screen. (All screens are blanked and unblanked simultaneously.)
Note that you must escape the newlines; here is an example of how you might set this in your ~/.xscreensaver file:
programs: \ qix -root \n\ ico -r -faces -sleep 1 -obj ico \n\ xdaliclock -builtin2 -root \n\ xv -root -rmode 5 image.gif -quit \n
:Make sure your $PATH environment variable is set up correctly before xscreensaver is launched, or it won't be able to find the programs listed in the programs resource.
To use a program as a screensaver, two things are required: that that program draw on the root window (or be able to be configured to draw on the root window); and that that program understand "virtual root" windows, as used by virtual window managers such as tvtwm?(1). (Generally, this is accomplished by just including the "vroot.h" header file in the program's source.)
Because xscreensaver was created back when dinosaurs roamed the earth, it still contains support for some things you've probably never seen, such as 1-bit monochrome monitors, grayscale monitors, and monitors capable of displaying only 8-bit colormapped images.
If there are some programs that you want to run only when using a color display, and others that you want to run only when using a monochrome display, you can specify that like this:
mono: mono-program -root \n\ color: color-program -root \n\:
PseudoColor: cmap-program -root \n\ TrueColor: 24bit-program -root \n\:
If you specify a particular visual for a program, and that visual does not exist on the screen, then that program will not be chosen to run. This means that on displays with multiple screens of different depths, you can arrange for appropriate hacks to be run on each. For example, if one screen is color and the other is monochrome, hacks that look good in mono can be run on one, and hacks that only look good in color will show up on the other.:
You shouldn't ever need to change the following resources:
The benefit to doing this is that xscreensaver can note that the user is active even when the X console is not the active one: if the user is typing in another virtual console, xscreensaver will notice that and will fail to activate. For example, if you're playing Quake in VGA-mode, xscreensaver won't wake up in the middle of your game and start competing for CPU.
The drawback to doing this is that perhaps you really do want idleness on the X console to cause the X display to lock, even if there is activity on other virtual consoles. If you want that, then set this option to False. (Or just lock the X console manually.)
The default value for this resource is True, on systems where it works.
The latest version of xscreensaver, an online version of this manual, and a FAQ can always be found at http://www.jwz.org/xscreensaver/
Copyright © 1991-2014 by Jamie Zawinski. Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty.
Jamie Zawinski <[email protected]>. Written in late 1991; version 1.0 posted to comp.sources.x on 17-Aug-1992.
Please let me know if you find any bugs or make any improvements.
And a huge thank you to the hundreds of people who have contributed, in large ways and small, to the xscreensaver collection over the past two decades!
Tutoriais de Tecnologia Web