aboutsummaryrefslogtreecommitdiff
path: root/unsaver.1
blob: 666520c806f0c57b90b49a3df62b71aeb180b98e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
.\" Man page generated from reStructuredText.
.
.
.nr rst2man-indent-level 0
.
.de1 rstReportMargin
\\$1 \\n[an-margin]
level \\n[rst2man-indent-level]
level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
-
\\n[rst2man-indent0]
\\n[rst2man-indent1]
\\n[rst2man-indent2]
..
.de1 INDENT
.\" .rstReportMargin pre:
. RS \\$1
. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
. nr rst2man-indent-level +1
.\" .rstReportMargin post:
..
.de UNINDENT
. RE
.\" indent \\n[an-margin]
.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
.nr rst2man-indent-level -1
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "UNSAVER" 1 "2021-12-23" "0.4.1" "Urchlay"
.SH NAME
unsaver \- deactivate screensaver on joystick activity
.\" RST source for unsaver(1) man page. Convert with:
.
.\" rst2man.py unsaver.rst > unsaver.1
.
.SH SYNOPSIS
.sp
unsaver [\fB\-i interval[s|ms]\fP] [\fB\-m\fP | \fB\-k keycode\fP | \fB\-b button\fP | \fB\-c command\fP | \fB\-x\fP ] [\fB\-j\fP | \fB\-f\fP] [\fB\-d\fP] [\fBjoystick [joystick ...]\fP]
.SH DESCRIPTION
.sp
unsaver lets you play games with your joysticks/gamepads without the screen
saver activating due to lack of keyboard/mouse input. It also prevents
the screensaver from activating when a fullscreen window is in use (e.g.
while watching a movie).
.sp
unsaver should be started from your \fB\&.xinitrc\fP or whatever X startup
script your window manager or desktop environment uses. By default, it
will exit when the X server does. There\(aqs no PID file: use "pkill unsaver"
if you need to kill the daemon.
.sp
Every \fIinterval\fP milliseconds (250, or whatever \fB\-i\fP is set to), unsaver
checks to see if there\(aqs been any activity on any of the josticks, or
if a fullscreen window exists. If so, it deactivates the screensaver
by sending a keystroke, clicking a mouse button, moving the mouse,
or executing a command (see "Monitoring Options", below).
.sp
Multiple joystick devices can be monitored. By default, unsaver monitors
up to 16 joysticks. These devices don\(aqt have to actually exist: they
can come and go as joysticks are plugged in and unplugged. See JOYSTICK
DEVICES if the defaults don\(aqt work for you.
.SH OPTIONS
.sp
With no options, the default interval is 250ms, the deactivation mode
is to send an otherwise\-unused keycode, and both joystick and fullscreen
monitoring is enabled.
.sp
A space is required between an option and its argument, as shown
above. Use e.g. \fB\-i 300\fP, not \fB\-i300\fP\&.
.SS General options
.INDENT 0.0
.TP
.B  \-\-help
Print usage summary and exit.
.TP
.B  \-d
Debug mode: run in foreground and print verbose messages.
.UNINDENT
.SS Monitoring options
.INDENT 0.0
.TP
.BI \-i \ <interval>
Interval to check for activity. Can be given in seconds
with \fIs\fP suffix (e.g. \fB1s\fP), or milliseconds with \fIm\fP
(e.g. \fB200m\fP). If just a number is given, it\(aqs assumed
to be in seconds if it\(aqs under 100, otherwise it\(aqs treated
as milliseconds. Default: 250m.
.TP
.B  \-j
Only monitor joysticks; don\(aqt try to detect fullscreen windows.
\fB\-j\fP and \fB\-f\fP are mutually exclusive.
.TP
.B  \-f
Only detect fullscreen windows; don\(aqt monitor joysticks.
\fB\-j\fP and \fB\-f\fP are mutually exclusive. Note that
\fBjoysticks\fP are ignored with \fB\-f\fP\&.
.UNINDENT
.SS Deactivation mode options
.sp
Only one of \fB\-k\fP/\fB\-b\fP/\fB\-m\fP/\fB\-c\fP/\fB\-x\fP is accepted.
.INDENT 0.0
.TP
.BI \-k \ <keycode>
Send this keycode when activity is detected. Default
(with no \fB\-k\fP/\fB\-b\fP/\fB\-m\fP/\fB\-c\fP/\fB\-x\fP options)
is to search the keymap for an unused code. If you set this
manually, it should be a keycode that \fIdoesn\(aqt\fP map to a keysym
in your usual keymapping (use "xmodmap \-pk" to find one).
.TP
.BI \-b \ <button>
Send a click of this button when activity is detected,
rather than a keystroke. Should be a button that
applications don\(aqt normally respond to (6 or higher),
but in some environments, the window manager responds to
all the \(aqextra\(aq buttons as though they were button 1.
.TP
.B  \-m
Send mouse movements rather than a keystroke. This will
move the pointer 10 pixels to the right and down, then
10 pixels to the left and up, then warp the pointer back
to its starting point.
.TP
.BI \-c \ <command>
Run a command when activity is detected, rather than
sending a fake keystroke/click/motion. It\(aqs recommended
to set \fIinterval\fP to at least 1 second when using this
option, to avoid excess process\-spawning overhead.
.TP
.B  \-x
Same as \fB\-c "xscreensaver\-command \-deactivate" \-i 1s\fP\&.
.UNINDENT
.SH NOTES
.sp
unsaver was tested with xlock(1), xscreensaver(1), and the built\-in
Xorg screensaver (see xset(1)). All 4 modes (keycode, mouse click, mouse
motion, command execution) work with xscreensaver. xlock doesn\(aqt have a
disable command nor respond to mouse motion, so use the keycode or click
modes with it. The "xset s" screen\-blanker works with keycodes, mouse
clicks, and mouse motion. I didn\(aqt test with gnome\-screensaver, sorry.
.sp
unsaver can monitor up to MAX_STICKS joysticks. This is a compile time
constant, normally set to 16. See the \fB\-\-help\fP output to find out
the compiled\-in default.
.sp
If the screensaver is configured to lock the screen, and it has already
done so, unsaver can\(aqt magically type your password for you.
.sp
unsaver depends on the XTest extension being present in the X server. If
you get a "X server doesn\(aqt support XTest extension" error, see your X
server documentation to find out how to enable XTest.
.sp
The fullscreen window monitoring has only been tested on a system with
a single monitor, and may not work properly in multi\-head environments.
.SH JOYSTICK DEVICES
.sp
It\(aqs recommended to let unsaver find the joysticks itself. However, you
can pass one or more joystick numbers if the default doesn\(aqt do the right
thing for you. Remember that the first joystick is numbered 0, not 1.
.sp
One reason to manually set the joystick list might be that your 2nd
joystick is rarely used, and your cat likes to play with it. To monitor
only one device, you can say \fBunsaver 0\fP\&.
.sp
When you manually set the list of devices, unsaver will only detect
hotplug events on the devices you gave it. If you plug in more joysticks,
they won\(aqt be monitored.
.sp
None of the joystick devices (whether autodetected or not) has to
actually exist when unsaver starts up, although their directory does
have to exist. This means unsaver can detect hotplug events, but you
have to be careful not to typo the device names.
.sp
If your system doesn\(aqt keep its joystick device nodes in /dev/input, and/or
if they\(aqre not named "js<num>", see ENVIRONMENT for a way to override
the default names.
.SH ENVIRONMENT
.INDENT 0.0
.TP
.B UNSAVER_JS_DIR
Path to joystick device nodes. If your OS keeps them
somewhere besides "/dev/input", set this variable.
.TP
.B UNSAVER_JS_NODE
Base name for joystick device nodes. "js" by default.
\fIDon\(aqt\fP set this to "event", unsaver doesn\(aqt speak the
full Linux event protocol.
.UNINDENT
.SH EXIT STATUS
.sp
Without the \-d option, the exit status is 0 (success) if unsaver
successfully forked into the background.
.sp
A non\-zero exit status means an error in the command line arguments,
or else fork() failed. No daemon will be running in this case.
.sp
With the \-d option, unsaver never exits until it\(aqs killed.
.SH BUGS
.sp
There\(aqs no way to distinguish between an invalid device number and a
device number that doesn\(aqt happen to exist yet because its device hasn\(aqt
been plugged in yet. Try to avoid typos, if you really have to use device
numbers (it\(aqs better to autodetect).
.sp
Normally once daemonized, unsaver is very robust. However, if something
does go wrong, there\(aqs no way to find out what. Probably there should
be a log file, or use syslog (or is that overkill?). The best you can
do for now is run it with \-d and maybe redirect stderr to a log file.
.sp
It should be (but currently isn\(aqt) possible to at least work in
mouse\-motion mode even without the XTest extension, via XWarpPointer().
.sp
unsaver isn\(aqt portable. It only works on Linux, at least for now, for
three reasons:
.INDENT 0.0
.INDENT 3.5
.INDENT 0.0
.IP \(bu 2
It uses the Linux joystick API.
.IP \(bu 2
It uses inotify(7) to detect joystick hotplug events.
.IP \(bu 2
I haven\(aqt even looked at other OSes to see if it would be possible
to port the code.
.UNINDENT
.UNINDENT
.UNINDENT
.\" EXAMPLES
.
.\" ========
.
.SH LICENSE
.sp
unsaver is released under the WTFPL: Do WTF you want with this.
.SH AUTHOR
.sp
unsaver was written by B. Watson <\fI\%yalhcru@gmail.com\fP>.
.SH SEE ALSO
.sp
jstest(1), jscal(1), sdl\-jstest(1), sdl2\-jstest(2), xscreensaver(1),
xautolock(1), xlock(1), xset(1)
.\" Generated by docutils manpage writer.
.