From 51ecaea4e23803053dfc5e289cd36db480410c1d Mon Sep 17 00:00:00 2001 From: Miles Alan Date: Sat, 13 Jun 2020 21:25:27 -0500 Subject: [PATCH] Add basic manpage and sync up README documentation --- .gitignore | 4 +-- Makefile | 5 ++++ README.md | 33 ++++++++++++++--------- lisgd.1 | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ lisgd.c | 1 - 5 files changed, 105 insertions(+), 16 deletions(-) create mode 100644 lisgd.1 diff --git a/.gitignore b/.gitignore index d6b3df4..f988e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -slig -slig.o +lisgd +lisgd.o config.h diff --git a/Makefile b/Makefile index e635b44..b8d762e 100644 --- a/Makefile +++ b/Makefile @@ -26,5 +26,10 @@ install: all cp -f lisgd ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/lisgd + mkdir -p ${DESTDIR}${PREFIX}/share/man/man1 + cp lisgd.1 ${DESTDIR}${PREFIX}/share/man/man1 + chmod 644 ${DESTDIR}${PREFIX}/share/man/man1 + + clean: rm -f config.h diff --git a/README.md b/README.md index 8395ac1..16ecdc8 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ # lisgd -Lisgd (libinput **synthetic** gesture daemon) lets you bind gestures based on +Lisgd (libinput synthetic gesture daemon) lets you bind gestures based on libinput touch events to run specific commands to execute. For example, dragging left to right with one finger could execute a particular command -like launching a terminal. L-R, R-L, U-D, and D-U swipe gestures are -supported with 1 through n fingers. +like launching a terminal. Directional L-R, R-L, U-D, and D-U gestures and +diagnoal LD-RU, RD-LU, UR-DL, UL-DR gestures are supported with 1 through +n fingers. Unlike other libinput gesture daemons, lisgd uses touch events to recognize **synthetic swipe gestures** rather than using the *libinput*'s @@ -31,16 +32,22 @@ Flags: - **-d [devicenodepath]**: Defines the dev filesystem device to monitor - Example: `lisgd -d /dev/input/input1` -- **-t [threshold_units]**: Number of libinput units (number) minimum to recognize a gesture +- **-t [threshold_units]**: Threshold in libinput units (pixels) after which a + gesture registers. Defaults to 300. - Example: `lisgd -t 400` +- **-r [milli]**: Number of degrees offset each 45-degree interval may still + be recognized within. Maximum value is 45. Default value is 15. E.g. U-D + is a 180 degree gesture but with 15 degrees of leniency will be recognized + between 165-195 degrees. + - Example: `lisgd -r 20` +- **-m [timeoutms]**: Number of milliseconds gestures must be performed within + to be registered. After the timeoutms value; the gesture won't be registered. + - Example: `lisgd -m 1200` - **-v**: Verbose mode, useful for debugging - Example: `lisgd -v` -- **-g [fingers,start,end,command]**: Defines a gesture; wherein fingers is a integer, start/end are {l,r,d,u}, and command is the command to execute - - Single Gesture Example: `lisgd -g "1,l,r,notify-send swiped lr"` - - Multiple Gestures Example: `lisgd -g "1,l,r,notify-send swiped lr" -g "1,r,l,noitfy-send swiped rl"` - -Full commandline-based configuration example: - -``` -lisgd -d /dev/input/input1 -g "1,l,r,notify-send swiped lr" -t 200 -v -``` +- **-g [nfingers,gesture,command]**: Allows you to bind a gesture wherein + nfingers is an integer, gesture is one of {LR,RL,DU,UD,DLUR,URDL,ULDR,DLUR}, + and command is the shell command to be executed. The -g option can be used + multiple times to bind multiple gestures. + - Single Gesture Example: `lisgd -g "1,LR,notify-send swiped lr"` + - Multiple Gestures Example: `lisgd -g "1,LR,notify-send swiped lr" -g "1,RL,noitfy-send swiped rl"` diff --git a/lisgd.1 b/lisgd.1 new file mode 100644 index 0000000..41eb124 --- /dev/null +++ b/lisgd.1 @@ -0,0 +1,78 @@ +.TH LISGD 1 + +.SH NAME +lisgd \- libinput synthetic gesture daemon + +.SH SYNOPSIS +.B lisgd +[\fB\-t\fR \fIthreshold\fR] +[\fB\-d\fR \fIdegreesofleniency\fR] +[\fB\-m\fR \fItimeoutms\fR] +[\fB\-o\fR \fIorientation\fR] +[\fB\-v\fR \fIverbose\fR] +[\fB\-g\fR \fIgesturespec\fR]... + + +.SH DESCRIPTION +.B lisgd +(or libinput **synthetic** gesture daemon) lets you bind gestures based on +libinput touch events to run specific commands to execute. For example, +dragging left to right with one finger could execute a particular command +like launching a terminal. Directional L-R, R-L, U-D, and D-U gestures and +diagnoal LD-RU, RD-LU, UR-DL, UL-DR gestures are supported with 1 through +n fingers. + +Unlike other libinput gesture daemons, lisgd uses touch events to +recognize synthetic swipe gestures rather than using the libinput's +gesture events. The advantage of this is that the synthetic gestures +you define via lisgd can be used on touchscreens, which normal libinput +gestures don't support. + +This program was built for use on the Pinephone however it could be used in +general for any device that supports touch events, like laptop touchscreens +or similar. You may want to adjust the threshold depending on the device +you're using. + + +.SH OPTIONS +.TP +.BR \-d ", " \-d\ devicepath\fR +Path of the dev filesystem device to monitor (like /dev/input/event1). + +.TP +.BR \-t ", " \-t\ distancethreshold\fR +Threshold in libinput units (pixels) after which a gesture registers. Defaults +to 300. + +.TP +.BR \-r ", " \-r\ degreesofleniency\fR +Number of degrees offset each 45-degree interval may still be recognized within. +Maximum value is 45. Default value is 15. E.g. U-D is a 180 degree gesture +but with 15 degrees of leniency will be recognized between 165-195 degrees. + +.TP +.BR \-m ", " \-m\ timeoutms\fR +Number of milliseconds gestures must be performed within to be registered. After +the timeoutms value; the gesture won't be registered. + +.TP +.BR \-v \fR +Enables verbose mode which prints debugging messages. + +.TP +.BR \-g ", " \-g\ nfingers,gesture,command\fR +Allow you to bind a gesture wherein nfingers is an integer, gesture is +one of {LR,RL,DU,UD,DLUR,URDL,ULDR,DLUR}, and the shell command to be executed. + +The -g option can be used multiple times to bind multiple gestures. + +.SH SEE ALSO +lisgd was built as part of Sxmo; an project to create a Pinephone UI out of +simple and suckless programs. See: http://sr.ht/mil/Sxmo + +.SH AUTHOR +.BR lisgd +is written by Miles Alan + +.SH CONTRIBUTING +Bugs and feature dicussions can be sent to ~mil/sxmo-devel@lists.sr.ht diff --git a/lisgd.c b/lisgd.c index f25e29f..e9cfff3 100644 --- a/lisgd.c +++ b/lisgd.c @@ -160,7 +160,6 @@ touchmotion(struct libinput_event *e) { struct libinput_event_touch *tevent; int slot; - double x, y; tevent = libinput_event_get_touch_event(e); slot = libinput_event_touch_get_slot(tevent);