Libinput: Change Touchpad 2 finger and 3 finger clicks

5,366

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.

Share:
5,366

Related videos on Youtube

Sadegh Ghasemi
Author by

Sadegh Ghasemi

Updated on September 18, 2022

Comments

  • Sadegh Ghasemi
    Sadegh Ghasemi over 1 year

    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?

  • Sadegh Ghasemi
    Sadegh Ghasemi over 6 years
    There is no such directory. There might be a difference between Arc & Ubuntu.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 6 years
    @SadeghGhasemi You have to create the directory. On my system: $ ll /etc/X11/xorg.conf.d -rw-r--r-- 1 root root 194 Jan 6 11:32 20-intel.conf -rw-r--r-- 1 root root 789 Dec 15 04:39 20-nvidia.conf
  • Sadegh Ghasemi
    Sadegh Ghasemi over 6 years
    Unfortunately, It doesn't work. I even created the file in /usr/share/X11/xorg.conf.d (which has a lot of .conf files.) but nothing is changed.
  • WinEunuuchs2Unix
    WinEunuuchs2Unix over 6 years
    @SadeghGhasemi In the link it describes conflicts between synaptics and libinput when they are both being used. Have you checked into that? Also see above removing synaptics completely: askubuntu.com/questions/964769/…
  • Sadegh Ghasemi
    Sadegh Ghasemi over 6 years
    I found the version of Libinput implemented by Ubuntu 17.04 doesn't support button remapping and other configurations on that page! I have to go with Synaptics if I want these features.