http://packetstormsecurity.org/UNIX/admin/xscreensaver-4.14.tar.gz
[xscreensaver] / driver / xscreensaver-command.man
1 .de EX          \"Begin example
2 .ne 5
3 .if n .sp 1
4 .if t .sp .5
5 .nf
6 .in +.5i
7 ..
8 .de EE
9 .fi
10 .in -.5i
11 .if n .sp 1
12 .if t .sp .5
13 ..
14 .TH XScreenSaver 1 "25-Oct-2003 (4.14)" "X Version 11"
15 .SH NAME
16 xscreensaver-command - control a running xscreensaver process
17 .SH SYNOPSIS
18 .B xscreensaver-command
19 [\-display \fIhost:display.screen\fP] \
20 [\-help] \
21 [\-demo] \
22 [\-prefs] \
23 [\-activate] \
24 [\-deactivate] \
25 [\-cycle] \
26 [\-next] \
27 [\-prev] \
28 [\-select \fIn\fP] \
29 [\-exit] \
30 [\-restart] \
31 [\-lock] \
32 [\-throttle] \
33 [\-unthrottle] \
34 [\-version] \
35 [\-time] \
36 [\-watch]
37 .SH DESCRIPTION
38 The \fIxscreensaver\-command\fP program controls a running \fIxscreensaver\fP
39 process by sending it client-messages.
40
41 .BR xscreensaver (1)
42 has a client-server model: the xscreensaver process is a
43 daemon that runs in the background; it is controlled by other
44 foreground programs such as \fIxscreensaver-command\fP and
45 .BR xscreensaver\-demo (1).
46
47 This program, \fIxscreensaver-command\fP, is a command-line-oriented tool; the 
48 .BR xscreensaver\-demo (1).
49 program is a graphical tool.
50 .SH OPTIONS
51 .I xscreensaver-command
52 accepts the following command-line options:
53 .TP 8
54 .B \-help
55 Prints a brief summary of command-line options.
56 .TP 8
57 .B \-demo
58 This just launches the
59 .BR xscreensaver\-demo (1)
60 program, in which one can experiment with the various graphics hacks
61 available, and edit parameters.
62 .TP 8
63 .B \-demo \fP\fInumber\fP
64 When the \fI\-demo\fP option is followed by an integer, it instructs 
65 the \fIxscreensaver\fP daemon to run that hack, and wait for the user
66 to click the mouse before deactivating (i.e., mouse motion does not
67 deactivate.)  This is the mechanism by which
68 .BR xscreensaver\-demo (1)
69 communicates with the
70 .BR xscreensaver (1)
71 daemon.  (The first hack in the list is numbered 1, not 0.)
72 .TP 8
73 .B \-prefs
74 Like the no-argument form of \fI\-demo\fP, but brings up that program's
75 Preferences panel by default.
76 .TP 8
77 .B \-activate
78 Tell xscreensaver to turn on immediately (that is, blank the screen, as if
79 the user had been idle for long enough.)  The screensaver will deactivate as
80 soon as there is any user activity, as usual.
81
82 It is useful to run this from a menu; you may wish to run it as
83 .EX
84 sleep 5 ; xscreensaver-command -activate
85 .EE
86 to be sure that you have time to take your hand off the mouse before
87 the screensaver comes on.  (Because if you jiggle the mouse, xscreensaver
88 will notice, and deactivate.)
89 .TP 8
90 .B \-deactivate
91 This tells xscreensaver to pretend that there has just been user activity.
92 This means that if the screensaver is active (the screen is blanked),
93 then this command will cause the screen to un-blank as if there had been
94 keyboard or mouse activity.  If the screen is locked, then the password
95 dialog will pop up first, as usual.  If the screen is not blanked, then
96 this simulated user activity will re-start the countdown (so, issuing
97 the \fI\-deactivate\fP command periodically is \fIone\fP way to prevent
98 the screen from blanking.)
99 .TP 8
100 .B \-cycle
101 If the screensaver is active (the screen is blanked), then stop the current
102 graphics demo and run a new one (chosen randomly.)
103 .TP 8
104 .B \-next
105 This is like either \fI\-activate\fP or \fI\-cycle\fP, depending on which is
106 more appropriate, except that the graphics hack that will be run is the next
107 one in the list, instead of a randomly-chosen one.  In other words, 
108 repeatedly executing -next will cause the xscreensaver process to invoke each
109 graphics demo sequentially.  (Though using the \fI\-demo\fP option is probably
110 an easier way to accomplish that.)
111 .TP 8
112 .B \-prev
113 This is like \fI\-next\fP, but cycles in the other direction.
114 .TP 8
115 .B \-select \fInumber\fP
116 Like \fI\-activate\fP, but runs the \fIN\fPth element in the list of hacks.
117 By knowing what is in the \fIprograms\fP list, and in what order, you can use
118 this to activate the screensaver with a particular graphics demo.  (The first
119 element in the list is numbered 1, not 0.)
120 .TP 8
121 .B \-exit
122 Causes the xscreensaver process to exit gracefully.  This is roughly the same
123 as killing the process with
124 .BR kill (1),
125 but it is easier, since you don't need to first figure out the pid.  
126
127 .B Warning:
128 never use \fIkill -9\fP with \fIxscreensaver\fP while the screensaver is
129 active.  If you are using a virtual root window manager, that can leave
130 things in an inconsistent state, and you may need to restart your window
131 manager to repair the damage.
132 .TP 8
133 .B \-lock
134 Tells the running xscreensaver process to lock the screen immediately.  
135 This is like \fI\-activate\fP, but forces locking as well, even if locking
136 is not the default (that is, even if xscreensaver's \fIlock\fP resource is
137 false, and even if the \fIlockTimeout\fP resource is non-zero.)
138
139 Note that locking doesn't work unless the \fIxscreensaver\fP process is
140 running as you.  See 
141 .BR xscreensaver (1)
142 for details.
143 .TP 8
144 .B \-throttle
145 Temporarily switch to ``blank screen'' mode, and don't run any display modes
146 at all, until the screensaver is next de-activated.  This is useful if you're
147 using a machine remotely, and you find that some display modes are using too
148 much CPU.  
149
150 (If you want to do this \fIpermanently\fP, that is, you want the screen saver
151 to only blank the screen and not run demos at all, then set the \fIprograms\fP
152 resource to an empty list:  See
153 .BR xscreensaver (1)
154 for details.)
155 .TP 8
156 .B \-unthrottle
157 Turn `-throttle' mode off and resume normal behavior.
158 .TP 8
159 .B \-version
160 Prints the version of xscreensaver that is currently running on the display:
161 that is, the actual version number of the running xscreensaver background 
162 process, rather than the version number of xscreensaver-command.  (To see
163 the version number of \fIxscreensaver-command\fP itself, use 
164 the \fI\-help\fP option.)
165 .TP 8
166 .B \-time
167 Prints the time at which the screensaver last activated or 
168 deactivated (roughly, how long the user has been idle or non-idle: but 
169 not quite, since it only tells you when the screen became blanked or
170 un-blanked.)
171 .TP 8
172 .B \-restart
173 Causes the screensaver process to exit and then restart with the same command
174 line arguments as last time.  Do this after you've changed the resource
175 database, to cause xscreensaver to notice the changes.
176
177 .B Warning:
178 if you have a \fI.xscreensaver\fP file, this might not do what you 
179 expect.  You're probably better off killing the existing 
180 xscreensaver (with \fIxscreensaver\-command -exit\fP) and then
181 launching it again.
182
183 The important point is, you need to make sure that the xscreensaver 
184 process is running as you.  If it's not, it won't be reading the 
185 right \fI.xscreensaver\fP file.
186 .TP 8
187 .B \-watch
188 Prints a line each time the screensaver changes state: when the screen
189 blanks, locks, unblanks, or when the running hack is changed.  This option
190 never returns; it is intended for use by shell scripts that want to react to
191 the screensaver in some way.  An example of its output would be:
192 .EX
193 BLANK Fri Nov  5 01:57:22 1999
194 RUN 34
195 RUN 79
196 RUN 16
197 LOCK Fri Nov  5 01:57:22 1999
198 RUN 76
199 RUN 12
200 UNBLANK Fri Nov  5 02:05:59 1999
201 .EE
202 The above shows the screensaver activating, running three different
203 hacks, then locking (perhaps because the lock-timeout went off) then
204 unblanking (because the user became active, and typed the correct
205 password.)  The hack numbers are their index in the `programs'
206 list (starting with 1, not 0, as for the \fI\-select\fP command.)
207
208 For example, suppose you want to run a program that turns down the volume
209 on your machine when the screen blanks, and turns it back up when the screen
210 un-blanks.  You could do that by running a Perl program like the following
211 in the background.  The following program tracks the output of 
212 the \fI\-watch\fP command and reacts accordingly:
213 .EX
214 #!/usr/bin/perl
215
216 my $blanked = 0;
217 open (IN, "xscreensaver-command -watch |");
218 while (<IN>) {
219     if (m/^(BLANK|LOCK)/) {
220         if (!$blanked) {
221             system "sound-off";
222             $blanked = 1;
223         }
224     } elsif (m/^UNBLANK/) {
225         system "sound-on";
226         $blanked = 0;
227     }
228 }
229 .EE
230 Note that LOCK might come either with or without a preceeding BLANK
231 (depending on whether the lock-timeout is non-zero), so the above program
232 keeps track of both of them.
233 .SH DIAGNOSTICS
234 If an error occurs while communicating with the \fIxscreensaver\fP daemon, or
235 if the daemon reports an error, a diagnostic message will be printed to
236 stderr, and \fIxscreensaver-command\fP will exit with a non-zero value.  If
237 the command is accepted, an indication of this will be printed to stdout, and
238 the exit value will be zero.
239 .SH ENVIRONMENT
240 .PP
241 .TP 8
242 .B DISPLAY
243 to get the host and display number of the screen whose saver is
244 to be manipulated.
245 .TP 8
246 .B PATH
247 to find the executable to restart (for the \fI\-restart\fP command).  
248 Note that this variable is consulted in the environment of 
249 the \fIxscreensaver\fP process, not the \fIxscreensaver-command\fP process.
250 .SH UPGRADES
251 The latest version of
252 .BR xscreensaver (1)
253 and related tools can always be found at http://www.jwz.org/xscreensaver/
254 .SH "SEE ALSO"
255 .BR X (1),
256 .BR xscreensaver (1)
257 .BR xscreensaver\-demo (1)
258 .SH COPYRIGHT
259 Copyright \(co 1992, 1993, 1997, 1998, 1999, 2000, 2001, 2002
260 by Jamie Zawinski.  Permission to use, copy, modify, distribute, and sell
261 this software and its documentation for any purpose is hereby granted without
262 fee, provided that the above copyright notice appear in all copies and that
263 both that copyright notice and this permission notice appear in supporting
264 documentation.  No representations are made about the suitability of this
265 software for any purpose.  It is provided "as is" without express or implied
266 warranty.
267 .SH AUTHOR
268 Jamie Zawinski <jwz@jwz.org>, 13-aug-92.
269
270 Please let me know if you find any bugs or make any improvements.