1xscreensaver-command(1) XScreenSaver manual xscreensaver-command(1)
2
3
4
6 xscreensaver-command - control a running xscreensaver process
7
9 xscreensaver-command [-display host:display.screen] [-help | -demo |
10 -prefs | -activate | -deactivate | -cycle | -next | -prev | -select n |
11 -exit | -restart | -lock | -version | -time | -watch]
12
14 The xscreensaver-command program controls a running xscreensaver
15 process by sending it client-messages.
16
17 xscreensaver(1) has a client-server model: the xscreensaver process is
18 a daemon that runs in the background; it is controlled by other fore‐
19 ground programs such as xscreensaver-command and xscreensaver-demo(1).
20
21 This program, xscreensaver-command, is a command-line-oriented tool;
22 the xscreensaver-demo(1). program is a graphical tool.
23
25 xscreensaver-command accepts the following command-line options:
26
27 -help Prints a brief summary of command-line options.
28
29 -demo This just launches the xscreensaver-demo(1) program, in which
30 one can experiment with the various graphics hacks available,
31 and edit parameters.
32
33 -demo number
34 When the -demo option is followed by an integer, it instructs
35 the xscreensaver daemon to run that hack, and wait for the user
36 to click the mouse before deactivating (i.e., mouse motion does
37 not deactivate.) This is the mechanism by which xscreen‐
38 saver-demo(1) communicates with the xscreensaver(1) daemon.
39 (The first hack in the list is numbered 1, not 0.)
40
41 -prefs Like the no-argument form of -demo, but brings up that pro‐
42 gram's Preferences panel by default.
43
44 -activate
45 Tell xscreensaver to turn on immediately (that is, blank the
46 screen, as if the user had been idle for long enough.) The
47 screensaver will deactivate as soon as there is any user activ‐
48 ity, as usual.
49
50 It is useful to run this from a menu; you may wish to run it as
51 sleep 5 ; xscreensaver-command -activate
52 to be sure that you have time to take your hand off the mouse
53 before the screensaver comes on. (Because if you jiggle the
54 mouse, xscreensaver will notice, and deactivate.)
55
56 -deactivate
57 This tells xscreensaver to pretend that there has just been
58 user activity. This means that if the screensaver is active
59 (the screen is blanked), then this command will cause the
60 screen to un-blank as if there had been keyboard or mouse
61 activity. If the screen is locked, then the password dialog
62 will pop up first, as usual. If the screen is not blanked,
63 then this simulated user activity will re-start the countdown
64 (so, issuing the -deactivate command periodically is one way to
65 prevent the screen from blanking.)
66
67 -cycle If the screensaver is active (the screen is blanked), then stop
68 the current graphics demo and run a new one (chosen randomly.)
69
70 -next This is like either -activate or -cycle, depending on which is
71 more appropriate, except that the graphics hack that will be
72 run is the next one in the list, instead of a randomly-chosen
73 one. In other words, repeatedly executing -next will cause the
74 xscreensaver process to invoke each graphics demo sequentially.
75 (Though using the -demo option is probably an easier way to
76 accomplish that.)
77
78 -prev This is like -next, but cycles in the other direction.
79
80 -select number
81 Like -activate, but runs the Nth element in the list of hacks.
82 By knowing what is in the programs list, and in what order, you
83 can use this to activate the screensaver with a particular
84 graphics demo. (The first element in the list is numbered 1,
85 not 0.)
86
87 -exit Causes the xscreensaver process to exit gracefully. This does
88 nothing if the display is currently locked.
89
90 Warning: never use kill -9 with xscreensaver while the screen‐
91 saver is active. If you are using a virtual root window man‐
92 ager, that can leave things in an inconsistent state, and you
93 may need to restart your window manager to repair the damage.
94
95 -lock Tells the running xscreensaver process to lock the screen imme‐
96 diately. This is like -activate, but forces locking as well,
97 even if locking is not the default (that is, even if xscreen‐
98 saver's lock resource is false, and even if the lockTimeout
99 resource is non-zero.)
100
101 Note that locking doesn't work unless the xscreensaver process
102 is running as you. See xscreensaver(1) for details.
103
104 -version
105 Prints the version of xscreensaver that is currently running on
106 the display: that is, the actual version number of the running
107 xscreensaver background process, rather than the version number
108 of xscreensaver-command. (To see the version number of
109 xscreensaver-command itself, use the -help option.)
110
111 -time Prints the time at which the screensaver last activated or
112 deactivated (roughly, how long the user has been idle or non-
113 idle: but not quite, since it only tells you when the screen
114 became blanked or un-blanked.)
115
116 -restart
117 Causes the screensaver process to exit and then restart with
118 the same command line arguments as last time. Do this after
119 you've changed the resource database, to cause xscreensaver to
120 notice the changes.
121
122 Warning: if you have a .xscreensaver file, this might not do
123 what you expect. You're probably better off killing the exist‐
124 ing xscreensaver (with xscreensaver-command -exit) and then
125 launching it again.
126
127 The important point is, you need to make sure that the xscreen‐
128 saver process is running as you. If it's not, it won't be
129 reading the right .xscreensaver file.
130
131 -watch Prints a line each time the screensaver changes state: when the
132 screen blanks, locks, unblanks, or when the running hack is
133 changed. This option never returns; it is intended for use by
134 shell scripts that want to react to the screensaver in some
135 way. An example of its output would be:
136 BLANK Fri Nov 5 01:57:22 1999
137 RUN 34
138 RUN 79
139 RUN 16
140 LOCK Fri Nov 5 01:57:22 1999
141 RUN 76
142 RUN 12
143 UNBLANK Fri Nov 5 02:05:59 1999
144 The above shows the screensaver activating, running three dif‐
145 ferent hacks, then locking (perhaps because the lock-timeout
146 went off) then unblanking (because the user became active, and
147 typed the correct password.) The hack numbers are their index
148 in the `programs' list (starting with 1, not 0, as for the
149 -select command.)
150
151 For example, suppose you want to run a program that turns down
152 the volume on your machine when the screen blanks, and turns it
153 back up when the screen un-blanks. You could do that by run‐
154 ning a Perl program like the following in the background. The
155 following program tracks the output of the -watch command and
156 reacts accordingly:
157 #!/usr/bin/perl
158
159 my $blanked = 0;
160 open (IN, "xscreensaver-command -watch |");
161 while (<IN>) {
162 if (m/^(BLANK|LOCK)/) {
163 if (!$blanked) {
164 system "sound-off";
165 $blanked = 1;
166 }
167 } elsif (m/^UNBLANK/) {
168 system "sound-on";
169 $blanked = 0;
170 }
171 }
172 Note that LOCK might come either with or without a preceding
173 BLANK (depending on whether the lock-timeout is non-zero), so
174 the above program keeps track of both of them.
175
177 If xscreensaver is running, but you want it to stop running screen
178 hacks (e.g., if you are logged in remotely, and you want the console to
179 remain locked but just be black, with no graphics processes running)
180 you can accomplish that by simply powering down the monitor remotely.
181 In a minute or so, xscreensaver will notice that the monitor is off,
182 and will stop running screen hacks. You can power off the monitor like
183 so:
184 xset dpms force off
185 See the xset(1) manual for more info.
186
187 You can also use xscreensaver-demo(1) to make the monitor power down
188 after a few hours, meaning that xscreensaver will run graphics until it
189 has been idle for the length of time you specified; and after that, the
190 monitor will power off, and screen hacks will stop being run.
191
193 If an error occurs while communicating with the xscreensaver daemon, or
194 if the daemon reports an error, a diagnostic message will be printed to
195 stderr, and xscreensaver-command will exit with a non-zero value. If
196 the command is accepted, an indication of this will be printed to std‐
197 out, and the exit value will be zero.
198
200 DISPLAY to get the host and display number of the screen whose saver is
201 to be manipulated.
202
203 PATH to find the executable to restart (for the -restart command).
204 Note that this variable is consulted in the environment of the
205 xscreensaver process, not the xscreensaver-command process.
206
208 The latest version of xscreensaver(1) and related tools can always be
209 found at http://www.jwz.org/xscreensaver/
210
212 X(1), xscreensaver(1), xscreensaver-demo(1), xset(1)
213
215 Copyright © 1992, 1993, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
216 2005 by Jamie Zawinski. Permission to use, copy, modify, distribute,
217 and sell this software and its documentation for any purpose is hereby
218 granted without fee, provided that the above copyright notice appear in
219 all copies and that both that copyright notice and this permission
220 notice appear in supporting documentation. No representations are made
221 about the suitability of this software for any purpose. It is provided
222 "as is" without express or implied warranty.
223
225 Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
226
227 Please let me know if you find any bugs or make any improvements.
228
229
230
231X Version 11 5.05-3 (06-Apr-2008) xscreensaver-command(1)