From aaa2f1e410f805794202022fde9df29aa04db30f Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 17 May 2020 03:56:35 -0400 Subject: 0.2.0, major surgery --- Makefile | 22 ++-- jsmond.1 | 95 ++++++++++------- jsmond.c | 342 +++++++++++++++++++++++++++++++++++++++++++----------------- jsmond.html | 96 ++++++++++------- jsmond.rst | 83 +++++++++------ 5 files changed, 425 insertions(+), 213 deletions(-) diff --git a/Makefile b/Makefile index c80b615..374ffbb 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,13 @@ MAX_STICKS=16 # base name of joystick devices on your OS, gets numbers 0 to MAX_STICKS -# appended to it during autodetection -JSDEVBASE="/dev/input/js" +# appended to it during autodetection. This is the base filename without +# the directory. If your first joystick is /dev/input/js0, say js here. +JSNODE=js -# If you can think of a reason to compile without X11 support, -# set this to 0 (or anything other than 1). Note that you can -# compile with X11 and then disable it at runtime with -x. -HAVE_X11=1 +# directory where joystick devices live. monitored via inotify(7) to +# detect hotplug events. +EVENTDIR=/dev/input # Intended for optimizations, but you could include other flags here. # Override this, not CFLAGS @@ -54,14 +54,10 @@ PROJ=jsmond # the .rst is the authoritative source for the version number. VERSION=$(shell fgrep '.. |version| replace::' $(PROJ).rst | cut -d' ' -f4) -DEFINES=-DVERSION=\"$(VERSION)\" -DMAX_STICKS=$(MAX_STICKS) -DJSDEVBASE=\"$(JSDEVBASE)\" - -ifeq ($(HAVE_X11),1) -CFLAGS+=$(shell pkg-config --cflags x11) -LDFLAGS+=$(shell pkg-config --libs x11) -DEFINES+=-DHAVE_X11 -endif +DEFINES=-DVERSION=\"$(VERSION)\" -DMAX_STICKS=$(MAX_STICKS) -DJSNODE=\"$(JSNODE)\" -DEVENTDIR=\"$(EVENTDIR)\" +CFLAGS+=$(shell pkg-config --cflags x11 xtst) +LDFLAGS+=$(shell pkg-config --libs x11 xtst) CFLAGS=$(OPTFLAGS) $(DEFINES) LDFLAGS+=$(LDEXTRA) diff --git a/jsmond.1 b/jsmond.1 index 1ab07d7..a68c8e7 100644 --- a/jsmond.1 +++ b/jsmond.1 @@ -1,6 +1,6 @@ .\" Man page generated from reStructuredText. . -.TH JSMOND 1 "2020-05-16" "0.1.0" "Urchlay" +.TH JSMOND 1 "2020-05-17" "0.2.0" "Urchlay" .SH NAME jsmond \- deactivate screensaver on joystick activity . @@ -36,52 +36,72 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] . .SH SYNOPSIS .sp -jsmond [\fB\-c command\fP] [\fB\-i seconds\fP] [\fB\-d\fP] [\fB\-x\fP] [\fBjoydev [joydev ...]\fP] +jsmond [\fB\-i interval\fP] [\fB\-k keycode\fP | \fB\-b button\fP] [\fB\-d dir\fP] [\fB\-j name\fP] [\fB\-D\fP] [\fBjoydev [joydev ...]\fP] .SH DESCRIPTION .sp jsmond lets you play games with your joysticks/gamepads without -xscreensaver activating due to lack of keyboard/mouse input. +the screen saver activating due to lack of keyboard/mouse input. .sp Multiple joystick devices can be monitored. By default, jsmond 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. .sp -Every \fIinterval\fP seconds (60, or whatever \fB\-i\fP is set to), jsmond +Every \fIinterval\fP milliseconds (250, or whatever \fB\-i\fP is set to), jsmond checks to see if there\(aqs been any activity on any of the devices it\(aqs -monitoring. If so, it runs the \fBxscreensaver\-command \-deactivate\fP -(or whatever the \fB\-c\fP argument is set to). The command will be run no -more than once every \fIinterval\fP seconds. +monitoring. If so, it sends a fake keystroke or mouse button click, which +the screen saver will see as activity. .sp It\(aqs recommended to let jsmond find the joysticks itself. However, you can pass one or more device names (or just numbers) if the default doesn\(aqt do the right thing for you. In this case, only these devices will be monitored (no search is done). +.sp +jsmond should be started from your \fB\&.xinitrc\fP or whatever X startup +script your windowmanager or desktop environment uses. By default, it +will exit when the X server does. There\(aqs no PID file: use "pkill jsmond" +if you need to kill the daemon. .SH OPTIONS .INDENT 0.0 .TP .B \-\-help Print usage summary .TP -.BI \-c \ -Run when activity was detected during the -last \fIinterval\fP\&. +.BI \-i \ +Interval to check for activity, in milliseconds. +Default: 250. .TP -.BI \-i \ -Interval to check for activity. Should be set a minute or -so less than your xscreensaver timeout. Setting this too low -will waste resources. Default: 60. +.BI \-k \ +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 \fIdoesn\(aqt\fP map to a keysym +in your usual keymapping (use "xmodmap \-pk" to find one). .TP -.B \-d -Debug mode: run in foreground and print verbose messages. +.BI \-b \