aboutsummaryrefslogtreecommitdiff
path: root/jsmond.rst
blob: 0f875d32a8c7526d5c8cd6a55e5a37ad36588148 (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
.. RST source for jsmond(1) man page. Convert with:
..   rst2man.py jsmond.rst > jsmond.1

.. |version| replace:: 0.2.0
.. |date| date::

======
jsmond
======

-------------------------------------------
deactivate screensaver on joystick activity
-------------------------------------------

:Manual section: 1
:Manual group: Urchlay
:Date: |date|
:Version: |version|

SYNOPSIS
========

jsmond [**-i interval**] [**-k keycode** | **-b button**] [**-d dir**] [**-j name**] [**-D**] [**joydev [joydev ...]**]

DESCRIPTION
===========

jsmond lets you play games with your joysticks/gamepads without
the screen saver activating due to lack of keyboard/mouse input.

Multiple joystick devices can be monitored. By default, jsmond
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.

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

It's recommended to let jsmond find the joysticks itself. However,
you can pass one or more device names (or just numbers) if the default
doesn't do the right thing for you. In this case, only these devices
will be monitored (no search is done).

jsmond should be started from your **.xinitrc** or whatever X startup
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 jsmond"
if you need to kill the daemon.

OPTIONS
=======

--help         Print usage summary

-i <millis>    Interval to check for activity, in milliseconds.
               Default: 250.

-k <keycode>   Send this keycode when activity is detected. Default
               is to search the keymap for an unused code. If you set this
               manually, it should be a keycode that *doesn't* map to a keysym
               in your usual keymapping (use "xmodmap -pk" to find one).

-b <button>    Send a click of this button when activity is detected,
               rather than a keystroke. Should be a button that
               applications don't normally respond to (6 or higher).

These options are intended for developers and  *really* shouldn't be
needed for normal use:

-d <dir>       Path to the directory containing joystick device nodes.
               Default is "/dev/input".

-j <name>      Name of joystick device nodes, without any numeric
               suffix. Default is "js".

-D             Debug mode: run in foreground and print verbose messages.

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

NOTES
=====

By default, jsmond searches for and monitors all the joysticks it can
find, up to MAX_STICKS (normally 16; see the **--help** output to find
the compiled-in default). You can override the search on the command
line by providing one or more **joydev** arguments, in which case only
those devices will be monitored.

**joydev** arguments can be either a path to a device node (e.g.
*/dev/input/js0* or similar), or a number, which will have the default
device basename prepended to it. This is normally "/dev/input/js", but
can be changed via the **-d** and **-j** options. Note that (currently)
all the joystick devices have to be in the same directory for jsmond
to detect hotplug events!

Note that it's *not* an error to give nonexistent joystick device names.
jsmond will wait for devices to come into existence (e.g. as created
by **udev**).

If the screensaver is configured to lock the screen, and it has already
activated, pressing a joystick button/direction will just bring up the
password dialog, same as pressing a key or mouse button would.

EXIT STATUS
===========

Without the -D option, the exit status is 0 (success) if jsmond
successfully forked into the background.

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.

With the -D option, jsmond 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
been plugged in yet. Try to avoid typos, if you really have to use device
names (better to autodetect).

Normally once daemonized, jsmond 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.

jsmond isn't portable. It only works on Linux, at least for now, for
three reasons:

- It uses the Linux joystick API.

- It uses inotify(7) to detect joystick hotplug events.

- I haven't even looked at other OSes to see if it would be possible
  to port the code.

.. EXAMPLES
.. ========

LICENSE
=======

jsmond is released under the WTFPL: Do WTF you want with this.

AUTHOR
======

jsmond was written by B. Watson <yalhcru@gmail.com>.

SEE ALSO
========

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