Ubuntu – How to configure touchpad two fingers tap as middle click in ubuntu 19.10? Libinput is used

libinputtouchpad

I would like that my touchpad two fingers tap works as a mouse middle click on ubuntu 19.10.The default in Ubuntu is the three tap fingers but I prefer using two fingers.

This was pretty easy in my former laptop using synaptics driver options (as explained here https://askubuntu.com/a/156545/1035668), but it looks like this new laptop is using a different driver and I haven't been able to figure out how to configure it as I would like.

Here you have the output of xinput list:

xinput list
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ MSFT0001:02 06CB:CD3E Touchpad            id=10   [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
    ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
    ↳ Power Button                              id=6    [slave  keyboard (3)]
    ↳ Video Bus                                 id=7    [slave  keyboard (3)]
    ↳ Power Button                              id=8    [slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C           id=9    [slave  keyboard (3)]
    ↳ Ideapad extra buttons                     id=11   [slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard              id=12   [slave  keyboard (3)]

The output of xinput list-props 10:

Device 'MSFT0001:02 06CB:CD3E Touchpad':
    Device Enabled (145):   1
    Coordinate Transformation Matrix (147): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
    libinput Tapping Enabled (282): 1
    libinput Tapping Enabled Default (283): 0
    libinput Tapping Drag Enabled (284):    1
    libinput Tapping Drag Enabled Default (285):    1
    libinput Tapping Drag Lock Enabled (286):   0
    libinput Tapping Drag Lock Enabled Default (287):   0
    libinput Tapping Button Mapping Enabled (288):  1, 0
    libinput Tapping Button Mapping Default (289):  1, 0
    libinput Natural Scrolling Enabled (290):   0
    libinput Natural Scrolling Enabled Default (291):   0
    libinput Disable While Typing Enabled (292):    1
    libinput Disable While Typing Enabled Default (293):    1
    libinput Scroll Methods Available (294):    1, 1, 0
    libinput Scroll Method Enabled (295):   1, 0, 0
    libinput Scroll Method Enabled Default (296):   1, 0, 0
    libinput Click Methods Available (297): 1, 1
    libinput Click Method Enabled (298):    1, 0
    libinput Click Method Enabled Default (299):    1, 0
    libinput Middle Emulation Enabled (300):    0
    libinput Middle Emulation Enabled Default (301):    0
    libinput Accel Speed (302): 0.000000
    libinput Accel Speed Default (303): 0.000000
    libinput Left Handed Enabled (304): 0
    libinput Left Handed Enabled Default (305): 0
    libinput Send Events Modes Available (267): 1, 1
    libinput Send Events Mode Enabled (268):    0, 0
    libinput Send Events Mode Enabled Default (269):    0, 0
    Device Node (270):  "/dev/input/event6"
    Device Product ID (271):    1739, 52542
    libinput Drag Lock Buttons (306):   <no items>
    libinput Horizontal Scroll Enabled (307):   1```

Best Answer

You can add

Option "TappingButtonMap" "lmr"

to the touchpad section of /usr/share/X11/xorg.conf.d/40-libinput.conf file like this:

Section "InputClass"
        Identifier "libinput touchpad catchall"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
        Driver "libinput"
        Option "TappingButtonMap" "lmr"
EndSection

lmr means "left/middle/right". By default 3-finger tap is for a middle-click (lrm).

It will permanently set this option (after a reboot). You can also test it by setting a xinput option:

xinput set-prop 10 288 0 1 

This should have an effect right away, but won't survive a reboot.