Libinput: Change Touchpad 2 finger and 3 finger clicks

Back in synaptics touchpad, it was possible to use:

synclient TapButton2=2 synclient TapButton3=3

and set two-finger and three-finger clicks. What are configurations for Libinput?


Solution 1:

Trying to achieve the same thing here, but with Libinput it is not possible (in fact, some params are hardcoded and not changeable).

I have a touchpad that also does clickpad (you can either "touch" or "click" on the pad).

What I want is to have the same things happening when touching 1, 2 or 3 fingers than when I click with 1, 2 ou 3 fingers (respectively):

  • 1 finger : normal left-click
  • 2 fingers : middle click (to past selected text, open links in tabs, etc.)
  • 3 finger : right-click (displaying context menu).

I can achieve this for the "tapping" with what @WinEunuuchs2Unix said hereabove.

As for the "clicking", you can only do either: - clicking as your hardware has been designed: most clickpad have 2 physical buttons at the button (one for left, one for right), so you can do that. - or clicking with 2 or 3 fingers anywhere on the pad, but then the default (and unchangeable, see libinput documentation) behaviour is right-click for 2 fingers and middle-click for 3 fingers.

For that, you have to add one of the following option to the code @WinEunuuchs2Unix gave:

Option "ClickMethod" "buttonareas" # respect the designed buttons

 

Option "ClickMethod" "clickfinger" # click anywhere you want

If you really want to get the desired effect (and invert the 2 and 3-click behaviour to respectively middle- and right-click), you would need to get back to synaptics drivers (instead of libinput), and use this wellknown code:

Option "TapButton1" "1"
Option "TapButton2" "2"
Option "TapButton3" "3"
Option "ClickFinger1" "1"
Option "ClickFinger2" "2"
Option "ClickFinger3" "3"

Solution 2:

From this page:

Button re-mapping

Swapping two- and three-finger tap for a touchpad is a straight forward example. Instead of the default three-finger tap for pasting you can configure two-finger tap pasting by setting the TappingButtonMap option in your Xorg configuration file. To set 1/2/3-finger taps to left/right/middle set TappingButtonMap to lrm, for left/middle/right set it to lmr.

/etc/X11/xorg.conf.d/30-touchpad.conf:

Section "InputClass"
    Identifier "touchpad"
    Driver "libinput"
    MatchIsTouchpad "on"
    Option "Tapping" "on"
    Option "TappingButtonMap" "lmr"
EndSection

Remember to remove MatchIsTouchpad "on" if your device is not a touchpad and adjust the Identifier accordingly.

You might want to read the entire page linked above as it covers many interesting topics such as running synaptics and libinput in parallel.