xscreensaver-command(1) | XScreenSaver manual | xscreensaver-command(1) |
xscreensaver-command - control a running xscreensaver process
xscreensaver-command [-display host:display.screen] [-help | -demo | -prefs | -activate | -deactivate | -cycle | -next | -prev | -select n | -exit | -restart | -lock | -suspend | -version | -time | -watch | -quiet | -verbose]
The xscreensaver-command program controls a running xscreensaver process by sending it client-messages.
xscreensaver(1) has a client-server model: the xscreensaver process is a daemon that runs in the background; it is controlled by other foreground programs such as xscreensaver-command and xscreensaver-demo(1).
This program, xscreensaver-command, is a command-line-oriented tool; the xscreensaver-demo(1). program is a graphical tool.
xscreensaver-command accepts the following command-line options:
It is useful to run this from a menu; you may wish to run it as
sleep 5 ; xscreensaver-command -activateto be sure that you have time to take your hand off the mouse before the screensaver comes on. (Because if you jiggle the mouse, xscreensaver will notice, and deactivate.)
Warning: never use kill -9 with xscreensaver while the screensaver is active. If you are using a virtual root window manager, that can leave things in an inconsistent state, and you may need to restart your window manager to repair the damage.
Note that locking doesn't work unless the xscreensaver process is running as you. See xscreensaver(1) for details.
BLANK Fri Nov 5 01:57:22 1999 RUN 34 RUN 79 RUN 16 LOCK Fri Nov 5 01:57:22 1999 RUN 76 RUN 12 UNBLANK Fri Nov 5 02:05:59 1999The above shows the screensaver activating, running three different hacks, then locking (perhaps because the lock-timeout went off) then unblanking (because the user became active, and typed the correct password.) The hack numbers are their index in the `programs' list (starting with 1, not 0, as for the -select command.)
For example, suppose you want to run a program that turns down the volume on your machine when the screen blanks, and turns it back up when the screen un-blanks. You could do that by running a Perl program like the following in the background. The following program tracks the output of the -watch command and reacts accordingly:
#!/usr/bin/perl my $blanked = 0; open (IN, "xscreensaver-command -watch |"); while (<IN>) {Note that LOCK might come either with or without a preceding BLANK (depending on whether the lock-timeout is non-zero), so the above program keeps track of both of them.
if (m/^(BLANK|LOCK)/) {
if (!$blanked) {
system "sound-off";
$blanked = 1;
}
} elsif (m/^UNBLANK/) {
system "sound-on";
$blanked = 0;
} }
If xscreensaver is running, but you want it to stop running screen hacks (e.g., if you are logged in remotely, and you want the console to remain locked but just be black, with no graphics processes running) you can accomplish that by simply powering down the monitor remotely. In a minute or so, xscreensaver will notice that the monitor is off, and will stop running screen hacks. You can power off the monitor like so:
xset dpms force off
See the xset(1) manual for more info.
You can also use xscreensaver-demo(1) to make the monitor power down after a few hours, meaning that xscreensaver will run graphics until it has been idle for the length of time you specified; and after that, the monitor will power off, and screen hacks will stop being run.
If an error occurs while communicating with the xscreensaver daemon, or if the daemon reports an error, a diagnostic message will be printed to stderr, and xscreensaver-command will exit with a non-zero value. If the command is accepted, an indication of this will be printed to stdout, and the exit value will be zero.
The latest version of xscreensaver(1) and related tools can always be found at https://www.jwz.org/xscreensaver/
Copyright © 1992-2020 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 <jwz@jwz.org>, 13-aug-1992.
Please let me know if you find any bugs or make any improvements.
5.45 (08-Dec-2020) | X Version 11 |