|
1 |
| -OSX users will miss the three-finger-drag feature when switch to Linux. With that feature, you can easily select text or drag something around. On Linux, there are two options to achieve this: |
2 |
| -* [mtrack](https://github.com/p2rkw/xf86-input-mtrack) |
3 |
| -* [libinput-gestures](https://github.com/bulletmark/libinput-gestures) |
| 1 | +# THREE FINGER DRAG |
| 2 | +OSX users will miss the three-finger-drag feature when switch to Linux. With that feature, you can easily select text or drag something around. On Linux, there are two common options to achieve this: |
| 3 | +1. [mtrack](https://github.com/p2rkw/xf86-input-mtrack) |
4 | 4 |
|
5 |
| -[three-finger-drag issue](https://github.com/bulletmark/libinput-gestures/issues/10) |
6 |
| -[three-finger-drag fork](https://github.com/daveriedstra/libinput-gestures/tree/three-finger-drag) |
| 5 | +set the following options in xorg.conf and you get three-finger-track |
| 6 | +``` |
| 7 | +Option "SwipeUpButton" "1" |
| 8 | +Option "SwipeDownButton" "1" |
| 9 | +Option "SwipeLeftButton" "1" |
| 10 | +Option "SwipeRightButton" "1" |
| 11 | +``` |
| 12 | + |
| 13 | +The problems of mtrack are: |
| 14 | +* not actively maintained |
| 15 | +* less "smooth" than libinput |
| 16 | +* not the default driver for trackpad of Manjaro or Ubuntu, and have some compatibility issues with GDM on my machine |
| 17 | + |
| 18 | + |
| 19 | +2. [libinput-gestures](https://github.com/bulletmark/libinput-gestures) |
| 20 | + |
| 21 | +libinput-gestures do not natively support three-finger-track. You need to use this fork [three-finger-drag fork](https://github.com/daveriedstra/libinput-gestures/tree/three-finger-drag) which is mentioned in this [libinput-gestures three-finger-drag issue](https://github.com/bulletmark/libinput-gestures/issues/10#issuecomment-441459797). As the author of libput-gestures [replied](https://github.com/bulletmark/libinput-gestures/issues/10#issuecomment-247980222), libinput-gestures won't support three-finger-track due to "To implement this would be messy, require significant processing overhead, and is discordant with the current design.". |
| 22 | + |
| 23 | +so if you use the [three-finger-drag fork](https://github.com/daveriedstra/libinput-gestures/tree/three-finger-drag) of libinput-gestures: |
| 24 | +* you can't use new features of libinput-gestures because the two repos can not be merged easily |
| 25 | +* extra configuration is needed |
| 26 | + ``` |
| 27 | + gesture swipebegin all 3 xdotool mousedown 1 |
| 28 | + gesture swipeend all 3 xdotool mouseup 1 |
| 29 | + gesture swipeupdate all 3 xdotool mousemove_relative -- x y |
| 30 | + ``` |
| 31 | +
|
| 32 | +# INSTALLATION |
| 33 | +
|
| 34 | +So with this tool, you can use three-finger-drag with libinput(the underlying tool libinput-gestures based on). You probably will use it with libinput-gestures side by side to add three-finger-drag support. |
| 35 | +``` |
| 36 | +1. clone the repo |
| 37 | +2. install libinput(you probably have it already) |
| 38 | +3. install xdotool(which includes libxdo) |
| 39 | +4. cargo build --release |
| 40 | +5. copy target/release/libinput-three-finger-drag to somewhere |
| 41 | +6. disable 3 finger swipe gesture in libinput-gestures, see below |
| 42 | +6. run libinput-three-finger-drag and check whether it works |
| 43 | +7. make libinput-three-finger-drag auto-start |
| 44 | +``` |
| 45 | +
|
| 46 | +## Disable 3 finger swipe gesture in libinput-gestures |
| 47 | +Modify libinput-gestures config file /etc/libinput-gestures.conf or ~/.config/libinput-gestures.conf. |
| 48 | +Add finger_count 4 to essentially disable 3 finger swipe. |
| 49 | +
|
| 50 | +change |
| 51 | +``` |
| 52 | +gesture swipe up xdotool key super+Page_Down |
| 53 | +``` |
| 54 | +to |
| 55 | +``` |
| 56 | +gesture swipe up 4 xdotool key super+Page_Down |
| 57 | +``` |
| 58 | +
|
| 59 | +# HOW IT WORKS |
| 60 | +Just like libinput-gestures. Fork |
| 61 | +``` |
| 62 | +libinput debug-events |
| 63 | +``` |
| 64 | +and read the output, which is trackpad "raw events". Filter out events of GESTURE_SWIPE_BEGIN, GESTURE_SWIPE_UPDATE and GESTURE_SWIPE_END. Simulate mouse_down on BEGIN, mouse_relative_move on UPDATE and mouse_up on END with libxdo. These three mouse action simulate a three-finger-drag. Call libxdo is more efficient than fork xdotool like libinput-gestures does. Especially when processing GESTURE_SWIPE_UPDATE events which is more frequent than BEGIN and END. |
0 commit comments