Rework logic to support diagnol gestures, rotation, and timeouts

This commit is contained in:
Miles Alan
2020-06-13 08:02:19 -05:00
parent 877beea273
commit b4dd89ae3a
3 changed files with 180 additions and 121 deletions
+27 -22
View File
@@ -1,27 +1,32 @@
/* Minimum cutoff for a gestures to take effect */
unsigned int threshold = 300;
/*
distancethreshold: Minimum cutoff for a gestures to take effect
degreesleniency: Offset degrees within which gesture is recognized (max=45)
timeoutms: Maximum duration for a gesture to take place in miliseconds
orientation: Number of 90 degree turns to shift gestures by
verbose: 1=enabled, 0=disabled; helpful for debugging
device: Path to the /dev/ filesystem device events should be read from
gestures: Array of gestures; binds num of fingers / gesturetypes to commands
Supported gestures: SwipeLR, SwipeRL, SwipeDU, SwipeUD,
SwipeDLUR, SwipeURDL, SwipeDRUL, SwipeULDR
*/
/* Verbose mode, 1 = enabled, 0 = disabled */
int verbose = 0;
/* Device libinput should read from */
unsigned int distancethreshold = 300;
unsigned int degreesleniency = 15;
unsigned int timeoutms = 800;
unsigned int orientation = 0;
unsigned int verbose = 0;
char *device = "/dev/input/event1";
/* Commands to execute upon recieving a swipe gesture */
Gesture gestures[] = {
/* fingers start end command */
{ 1, Left, Right, "xdotool key --clearmodifiers Alt+Shift+e" },
{ 1, Right, Left, "xdotool key --clearmodifiers Alt+Shift+r" },
{ 2, Left, Right, "xdotool key --clearmodifiers Alt+e" },
{ 2, Right, Left, "xdotool key --clearmodifiers Alt+r" },
{ 2, Down, Up, "pidof svkbd-sxmo || svkbd-sxmo &" },
{ 2, Up, Down, "pkill -9 svkbd-sxmo" },
{ 3, Down, Up, "sxmo_vol.sh up" },
{ 3, Up, Down, "sxmo_vol.sh down" },
{ 4, Down, Up, "sxmo_brightness.sh up" },
{ 4, Up, Down, "sxmo_brightness.sh down" },
/* nfingers gesturetype command */
{ 1, SwipeLR, "xdotool key --clearmodifiers Alt+Shift+e" },
{ 1, SwipeRL, "xdotool key --clearmodifiers Alt+Shift+r" },
{ 1, SwipeDLUR, "sxmo_vol.sh up" },
{ 1, SwipeURDL, "sxmo_vol.sh down" },
{ 1, SwipeDRUL, "sxmo_brightness.sh up" },
{ 1, SwipeULDR, "sxmo_brightness.sh down" },
{ 2, SwipeLR, "xdotool key --clearmodifiers Alt+e" },
{ 2, SwipeRL, "xdotool key --clearmodifiers Alt+r" },
{ 2, SwipeDU, "pidof svkbd-sxmo || svkbd-sxmo &" },
{ 2, SwipeUD, "pkill -9 svkbd-sxmo" },
};