In MacOS, there are additional things you can do.
* Spread or bring closer 2-4 fingers.
* Swipe from the edge to do a different action than swiping in the bulk of the pad.
Are there any system limitations on linux that prevent the implementation of such gestures?
(Also, syngestures separately recognizes and supports both taps and swipes, and it supports both/either with anywhere from 1 to 5 fingers.)
With syngestures, we can
* Tap with 1-5 fingers. (5 actions)
* Swipe with one finger (just the mouse) (1 action)
* Swipe with two fingers either horizontally or vertically (usually scroll) (2 actions)
* Swipe with 3,4,5 fingers either up/down/left/right (3x4=12 actions)
Total is 20 actions. So actually there are more possibilities with syngestures.
It’s easy to separate that into pre- and post- hooks, but the most reliable method I found for counting fingers in a gesture is “the maximum number of fingers during the gesture at any point” as it allows for variations in timing, location, direction, etc of first, second, subsequent fingers for a multi-finger gesture (you can’t assume they’re all present from the very start or that one finger won’t accidentally be raised mid-gesture). I’d have to change that to “detect number of fingers within xx ms of start of gesture” but that is somewhat problematic because the cursor position actually changes in response to touch between when your fist finger touched the trackpad and the time when (in your example) the third finger was finally added to the gesture (even if that all takes place in “a split second”). So it can be done but you might need to be intentional about being more careful with your three-finger swipe-to-drag to ensure the cursor remains within the desired click area until your third finger has made contact with the trackpad and hover there a brief moment to allow the daemon to determine you’re not going to add a fourth finger to the mix (changing it to another gesture altogether).
It would be entirely possible to retroactively generate a mouse down event at the original gesture start (with the first finger) when the third finger is added and no fourth finger is added, but that might be jarring from a UX perspective (cursor moves out of the bounding rectangle then the drag starts some ms later).
Basically, it is an independent subscriber to RawInput messages that only keeps track of whether or not to send three-finger drag, and posts emulated mouse messages using SendInput. I have a few other scripts that each run as independent userland processes that only monitors their own trigger and nothing else.
Tangentially, my TPMouse[1] script implemented inertia in a framerate-independent way so that it uses very little resource while having perfect simulation stability.
A previous discussion where I explained the analytic derivation for this low-resource exact-solution damped inertia can be seen in [10]
[0] https://github.com/EsportToys/PrecisionThreeFingerDrag/blob/...
[1] https://github.com/EsportToys/TPMouse
[10] https://old.reddit.com/r/Trackballs/comments/ym9q2t/tpmouse_...
More importantly, there is a solution for fixing this and I've done my part by open sourcing a multi-touch gesture solution (userland daemon) that's driver-agnostic and runs on top of the vendor-provided drivers w/ their correct acceleration curves [1].
(But TBH I don't know if this applies to Apple's trackpad because I don't know if there are any first-party drivers w/ proper acceleration curves for Linux or if they've all been – unfortunately poorly – reverse engineered.)
[0]: https://neosmart.net/blog/multi-touch-gestures-on-linux/
[1]: https://github.com/mqudsi/syngesture/