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