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