From b06b668dd6a020d19bcafca8e9dff8b2486019f8 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 20 May 2020 03:03:46 -0400 Subject: nitpickery --- unsaver.1 | 51 +++++++++++++++++++++++++++++++-------------------- unsaver.c | 10 +++++++--- unsaver.html | 49 +++++++++++++++++++++++++++++-------------------- unsaver.rst | 49 ++++++++++++++++++++++++++++++------------------- 4 files changed, 97 insertions(+), 62 deletions(-) diff --git a/unsaver.1 b/unsaver.1 index 3ed224e..5fcf97a 100644 --- a/unsaver.1 +++ b/unsaver.1 @@ -36,7 +36,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] . .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] [\fBjoydev [joydev ...]\fP] +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 @@ -50,16 +50,23 @@ 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 devices it\(aqs -monitoring. If so, it sends a fake mouse movement, keystroke, or mouse -button click, which the screen saver will see as activity. -.sp -Multiple joystick devices can be monitored. By default, unsaver -monitors up to 16 devices, named /dev/input/js0 through js15. -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. +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 @@ -86,7 +93,7 @@ Only monitor joysticks; don\(aqt try to detect fullscreen windows. .B \-f Only detect fullscreen windows; don\(aqt monitor joysticks. \fB\-j\fP and \fB\-f\fP are mutually exclusive. Note that -\fBjoydevs\fP are ignored with \fB\-f\fP\&. +\fBjoysticks\fP are ignored with \fB\-f\fP\&. .UNINDENT .SS Deactivation mode options .sp @@ -121,9 +128,6 @@ option, to avoid excess process\-spawning overhead. .B \-x Same as \fB\-c "xscreensaver\-command \-deactivate" \-i 1s\fP\&. .UNINDENT -.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\&. .SH NOTES .sp unsaver was tested with xlock(1), xscreensaver(1), and the built\-in @@ -152,6 +156,10 @@ 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. @@ -167,10 +175,12 @@ the default names. .SH ENVIRONMENT .INDENT 0.0 .TP -.B UNSAVER_JS_DIR Path to joystick device nodes. If your OS keeps them +.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. +.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 @@ -185,10 +195,10 @@ or else fork() failed. No daemon will be running in this case. With the \-d option, unsaver never exits until it\(aqs killed. .SH BUGS .sp -There\(aqs no way to distinguish between an invalid device name and a -device name that doesn\(aqt happen to exist yet because its device hasn\(aqt +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 -names (better to autodetect). +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 @@ -228,6 +238,7 @@ unsaver is released under the WTFPL: Do WTF you want with this. 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) +jstest(1), jscal(1), sdl\-jstest(1), sdl2\-jstest(2), xscreensaver(1), +xautolock(1), xlock(1), xset(1) .\" Generated by docutils manpage writer. . diff --git a/unsaver.c b/unsaver.c index a612ff2..ec502df 100644 --- a/unsaver.c +++ b/unsaver.c @@ -1,3 +1,7 @@ +/* unsaver, by B. Watson, released under the WTFPL. + the latest version of this file can be found at: + http://urchlay.naptime.net/repos/unsaver/ */ + /* need this, or else we don't get a prototype for strdup() from string.h */ #define _XOPEN_SOURCE 500 @@ -77,10 +81,10 @@ struct inotify_event *inotify_ev = (struct inotify_event *)inotify_buf; /* not going to include pages of usage info duplicating the man page */ void usage(void) { printf(PROJ " v" VERSION " by B. Watson, WTFPL\n"); - printf("Usage: %s [-i interval] [-m | -b button | -k keycode | -c command | -x]\n", self); - printf(" [-j | -f ] [-d] [inputdir] [joystick [...]]\n"); + printf("Usage: %s [-i interval] [-k keycode | -b button | -m | -c command | -x]\n", self); + printf(" [-j | -f ] [-d] [joystick [...]]\n"); printf("Built-in defaults: MAX_STICKS=%d, -d " EVENTDIR ", -j " JSNODE "\n", MAX_STICKS); - printf("See man page for details\n"); + printf("See man page for details.\n"); exit(0); } diff --git a/unsaver.html b/unsaver.html index 878eb10..17188e3 100644 --- a/unsaver.html +++ b/unsaver.html @@ -382,7 +382,7 @@ ul.auto-toc {

SYNOPSIS

-

unsaver [-i interval[s|ms]] [-m | -k keycode | -b button | -c command | -x ] [-j | -f] [-d] [joydev [joydev ...]]

+

unsaver [-i interval[s|ms]] [-m | -k keycode | -b button | -c command | -x ] [-j | -f] [-d] [joystick [joystick ...]]

DESCRIPTION

@@ -395,17 +395,22 @@ script your window manager or desktop environment uses. By default, it will exit when the X server does. There's no PID file: use "pkill unsaver" if you need to kill the daemon.

Every interval milliseconds (250, or whatever -i is set to), unsaver -checks to see if there's been any activity on any of the devices it's -monitoring. If so, it sends a fake mouse movement, keystroke, or mouse -button click, which the screen saver will see as activity.

-

Multiple joystick devices can be monitored. By default, unsaver -monitors up to 16 devices, named /dev/input/js0 through js15. -These devices don't have to actually exist: they can come and go -as joysticks are plugged in and unplugged. See JOYSTICK DEVICES -if the defaults don't work for you.

+checks to see if there's 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).

+

Multiple joystick devices can be monitored. By default, unsaver monitors +up to 16 joysticks. These devices don't have to actually exist: they +can come and go as joysticks are plugged in and unplugged. See JOYSTICK +DEVICES if the defaults don't work for you.

OPTIONS

+

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.

+

A space is required between an option and its argument, as shown +above. Use e.g. -i 300, not -i300.

General options

@@ -442,7 +447,7 @@ as milliseconds. Default: 250m.-f +joysticks are ignored with -f.
Only detect fullscreen windows; don't monitor joysticks. -j and -f are mutually exclusive. Note that -joydevs are ignored with -f.
@@ -483,8 +488,6 @@ option, to avoid excess process-spawning overhead. Same as -c "xscreensaver-command -deactivate" -i 1s. -

A space is required between an option and its argument, as shown -above. Use e.g. -i 300, not -i300.

@@ -511,6 +514,9 @@ a single monitor, and may not work properly in multi-head environments.

It's recommended to let unsaver find the joysticks itself. However, you can pass one or more joystick numbers if the default doesn't do the right thing for you. Remember that the first joystick is numbered 0, not 1.

+

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 unsaver 0.

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't be monitored.

@@ -525,10 +531,12 @@ the default names.

ENVIRONMENT

-
UNSAVER_JS_DIR Path to joystick device nodes. If your OS keeps them
-
somewhere besides "/dev/input", set this variable.
-
UNSAVER_JS_NODE Base name for joystick device nodes. "js" by default.
-
Don't set this to "event", unsaver doesn't speak the +
UNSAVER_JS_DIR
+
Path to joystick device nodes. If your OS keeps them +somewhere besides "/dev/input", set this variable.
+
UNSAVER_JS_NODE
+
Base name for joystick device nodes. "js" by default. +Don't set this to "event", unsaver doesn't speak the full Linux event protocol.
@@ -542,10 +550,10 @@ or else fork() failed. No daemon will be running in this case.

BUGS

-

There's no way to distinguish between an invalid device name and a -device name that doesn't happen to exist yet because its device hasn't +

There's no way to distinguish between an invalid device number and a +device number that doesn't happen to exist yet because its device hasn't been plugged in yet. Try to avoid typos, if you really have to use device -names (better to autodetect).

+numbers (it's better to autodetect).

Normally once daemonized, unsaver is very robust. However, if something does go wrong, there's no way to find out what. Probably there should be a log file, or use syslog (or is that overkill?).

@@ -577,7 +585,8 @@ to port the code.

SEE ALSO

-

jstest(1), jscal(1), sdl-jstest(1), sdl2-jstest(2)

+

jstest(1), jscal(1), sdl-jstest(1), sdl2-jstest(2), xscreensaver(1), +xautolock(1), xlock(1), xset(1)

diff --git a/unsaver.rst b/unsaver.rst index b66e2ad..734d828 100644 --- a/unsaver.rst +++ b/unsaver.rst @@ -20,7 +20,7 @@ deactivate screensaver on joystick activity SYNOPSIS ======== -unsaver [**-i interval[s|ms]**] [**-m** | **-k keycode** | **-b button** | **-c command** | **-x** ] [**-j** | **-f**] [**-d**] [**joydev [joydev ...]**] +unsaver [**-i interval[s|ms]**] [**-m** | **-k keycode** | **-b button** | **-c command** | **-x** ] [**-j** | **-f**] [**-d**] [**joystick [joystick ...]**] DESCRIPTION =========== @@ -36,19 +36,26 @@ will exit when the X server does. There's no PID file: use "pkill unsaver" if you need to kill the daemon. Every *interval* milliseconds (250, or whatever **-i** is set to), unsaver -checks to see if there's been any activity on any of the devices it's -monitoring. If so, it sends a fake mouse movement, keystroke, or mouse -button click, which the screen saver will see as activity. +checks to see if there's 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). -Multiple joystick devices can be monitored. By default, unsaver -monitors up to 16 devices, named /dev/input/js0 through js15. -These devices don't have to actually exist: they can come and go -as joysticks are plugged in and unplugged. See JOYSTICK DEVICES -if the defaults don't work for you. +Multiple joystick devices can be monitored. By default, unsaver monitors +up to 16 joysticks. These devices don't have to actually exist: they +can come and go as joysticks are plugged in and unplugged. See JOYSTICK +DEVICES if the defaults don't work for you. OPTIONS ======= +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. + +A space is required between an option and its argument, as shown +above. Use e.g. **-i 300**, not **-i300**. + General options --------------- @@ -70,7 +77,7 @@ Monitoring options -f Only detect fullscreen windows; don't monitor joysticks. **-j** and **-f** are mutually exclusive. Note that - **joydevs** are ignored with **-f**. + **joysticks** are ignored with **-f**. Deactivation mode options ------------------------- @@ -100,9 +107,6 @@ Only one of **-k**/**-b**/**-m**/**-c**/**-x** is accepted. -x Same as **-c "xscreensaver-command -deactivate" -i 1s**. -A space is required between an option and its argument, as shown -above. Use e.g. **-i 300**, not **-i300**. - NOTES ===== @@ -134,6 +138,10 @@ It's recommended to let unsaver find the joysticks itself. However, you can pass one or more joystick numbers if the default doesn't do the right thing for you. Remember that the first joystick is numbered 0, not 1. +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 **unsaver 0**. + 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't be monitored. @@ -150,10 +158,12 @@ the default names. ENVIRONMENT =========== -UNSAVER_JS_DIR Path to joystick device nodes. If your OS keeps them +UNSAVER_JS_DIR + Path to joystick device nodes. If your OS keeps them somewhere besides "/dev/input", set this variable. -UNSAVER_JS_NODE Base name for joystick device nodes. "js" by default. +UNSAVER_JS_NODE + Base name for joystick device nodes. "js" by default. *Don't* set this to "event", unsaver doesn't speak the full Linux event protocol. @@ -171,10 +181,10 @@ With the -d option, unsaver never exits until it's killed. BUGS ==== -There's no way to distinguish between an invalid device name and a -device name that doesn't happen to exist yet because its device hasn't +There's no way to distinguish between an invalid device number and a +device number that doesn't happen to exist yet because its device hasn't been plugged in yet. Try to avoid typos, if you really have to use device -names (better to autodetect). +numbers (it's better to autodetect). Normally once daemonized, unsaver is very robust. However, if something does go wrong, there's no way to find out what. Probably there should @@ -213,4 +223,5 @@ unsaver was written by B. Watson . SEE ALSO ======== -jstest(1), jscal(1), sdl-jstest(1), sdl2-jstest(2) +jstest(1), jscal(1), sdl-jstest(1), sdl2-jstest(2), xscreensaver(1), +xautolock(1), xlock(1), xset(1) -- cgit v1.2.3