bulletmark / libinput-gestures

Actions gestures on your touchpad using libinput
3.9k stars 241 forks source link

Differentiate 2 from 3/4 finger pinch #277

Closed patarapolw closed 3 years ago

patarapolw commented 3 years ago
$ libinput-gestures -l
libinput-gestures: session ubuntu+x11 on Linux-5.4.0-48-generic-x86_64-with-glibc2.29, python 3.8.5, libinput 1.15.5
/usr/bin/libinput-gestures: hash 9f979356e75d2fde95745b2036f97f24
Gestures configured in ~/.config/libinput-gestures.conf:
swipe up         3 _internal ws_up
swipe up         4 xdotool key super+End
swipe down       3 _internal ws_down
swipe down       4 xdotool key super+Home
swipe left       3 xdotool key alt+Right
swipe right      3 xdotool key alt+Left
pinch in           xdotool key super+s
libinput-gestures: device /dev/input/by-path/pci-0000:00:1d.0-usb-0:1.8.3:1.2-event-mouse(event6): bcm5974

Describe the issue

Would it be possible to differentiate 2 from 3/4 finger pinch?

bulletmark commented 3 years ago

Libinput (and thus this utility) does already support 2 finger pinch. Did you try it?

Run libinput-gestures -d in the terminal and do various gestures to see them reported.

bulletmark commented 3 years ago

Regarding your last comment about 4 finger pinch not working. That will be due to your older touchpad device, not libinput. My old Dell XPS 13 laptop touchpad only reported up to 3 finger gestures. My newer XPS 13 touchpad reports up to 4 finger gestures.

patarapolw commented 3 years ago

Maybe it is due to misclassification of SWIPE vs PINCH?

libinput-gestures: PINCH in 4 [-0.25, 1.99]
   xdotool key super+s
libinput-gestures: PINCH out 4 [0.18000000000000016, -1.04]
   xdotool key super+End
libinput-gestures: PINCH in 3 [-1.15, 3.3899999999999997]
libinput-gestures: SWIPE right 3 [113.5, -94.87]
   xdotool key alt+Left
libinput-gestures: PINCH in 3 [-2.1, 6.0600000000000005]
libinput-gestures: PINCH out 3 [0.47, -1.41]
libinput-gestures: PINCH in 3 [-0.62, 3.02]
libinput-gestures: SWIPE up 3 [131.1, -180.02]
   _internal ws_up
libinput-gestures: PINCH in 4 [-0.77, 4.7]
   xdotool key super+s
libinput-gestures: SWIPE right 4 [146.19, -122.82]
libinput-gestures: PINCH in 4 [-0.9, 3.33]
   xdotool key super+s
libinput-gestures: SWIPE up 4 [180.82000000000002, -198.99]
   xdotool key super+End
libinput-gestures: PINCH out 4 [0.08000000000000007, -0.4]
   xdotool key super+End
libinput-gestures: PINCH in 2 [-2.53, 4.529999999999999]
   xdotool key ctrl+minus
libinput-gestures: PINCH in 2 [-2.24, 3.0799999999999996]
   xdotool key ctrl+minus
libinput-gestures: PINCH in 4 [-0.41999999999999993, 3.45]
   xdotool key super+s
libinput-gestures: PINCH out 4 [0.10000000000000009, -0.9199999999999999]
   xdotool key super+End
libinput-gestures: SWIPE down 3 [-29.18, 137.51]
   _internal ws_down
bulletmark commented 3 years ago

Please explain what you are suggesting/asking? And how that relates to the output you posted? Libinput decides whether a gesture is a PINCH or a SWIPE and reports that to this utility so are you saying libinput is confusing your PINCH and SWIPE gestures?

bulletmark commented 3 years ago

BTW, you said 4 finger pinch gestures do not work yet here you clearly show they are actually working.

patarapolw commented 3 years ago

xdotool key ctrl+plus/minus do work in Terminal, but not in web browser.

$ libinput-gestures -l                                           
libinput-gestures: session ubuntu+x11 on Linux-5.4.0-48-generic-x86_64-with-glibc2.29, python 3.8.5, libinput 1.15.5
/usr/bin/libinput-gestures: hash 9f979356e75d2fde95745b2036f97f24
Gestures configured in ~/.config/libinput-gestures.conf:
swipe up         3 _internal ws_up
swipe up         4 xdotool key super+End
swipe down       3 _internal ws_down
swipe down       4 xdotool key super+Home
swipe left       3 xdotool key alt+Right
swipe right      3 xdotool key alt+Left
pinch in         4 xdotool key super+s
pinch out        4 xdotool key super+End
pinch in         3 xdotool key ctrl+minus
pinch out        3 xdotool key ctrl+plus
pinch in         2 xdotool key ctrl+minus
pinch out        2 xdotool key ctrl+plus
libinput-gestures: device /dev/input/by-path/pci-0000:00:1d.0-usb-0:1.8.3:1.2-event-mouse(event6): bcm5974

4 finger pinch in/out do work perfectly, though; but sometimes I confused with 5 finger pinch (which libinput-gesture -d cannot detect).

bulletmark commented 3 years ago

So, after all this, what is the bug you are reporting here with libinput-gestures?

patarapolw commented 3 years ago

xdotool key ctrl+equal/minus do not work in Brave for some reasons, but do work in Firefox and Chromium, albeit a little slow.

So, my problem is mostly solved. However, I must report that 2/3 finger pinch are not reliable.

pinch in         3 xdotool key ctrl+minus
pinch out        3 xdotool key ctrl+equal
pinch in         2 xdotool key ctrl+minus
pinch out        2 xdotool key ctrl+equal
bulletmark commented 3 years ago

What does "not reliable" mean?

patarapolw commented 3 years ago

Two and three finger pinches, especially with index and middle finger, fall into multiple scenarios

Also, it sometimes triggered an error.

libinput error: event6  - bcm5974: kernel bug: Touch jump detected and discarded.
See https://wayland.freedesktop.org/libinput/doc/1.15.5/touchpad-jumping-cursors.html for details

Bug is almost nil for 4 fingers pinch, or for events involving thumb.

bulletmark commented 3 years ago

Please follow the steps in the troubleshooting section. You can turn off libinput-gestures completely and run libinput debug-events directly where you will see that all gesture detection is done by libinput so all your complaints are actually about libinput, not libinput-gestures. That Touch jump detected and discarded is reported sometimes by libinput but is seen by many/most users, has long existed, and appears to be benign/harmless.

patarapolw commented 3 years ago

Original problems already solved anyway (Brave browser-specific), and I believe specificity / performance problem is because of underlying libinput...

Thank you for your time.