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