10

I switched my ubuntu from 21.10 impish to 22.04 jammy which implied to leave x11 for wayland.

I prevented unsolicited selection paste or unwanted closed tabs by completely disabling middle click with this line into my .bashrc :

xinput set-prop 'Synaptics TM3289-021' 'libinput Middle Emulation Enabled' 1

It was working fine with x11. After the upgrade, I get this error message

WARNING: running xinput against an Xwayland server. See the xinput man page for details.

unable to find device Synaptics TM3289-021

When I do xinput list, I don't get my touchpad but rather

WARNING: running xinput against an Xwayland server. See the xinput man page for details.
⎡ Virtual core pointer                      id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ xwayland-pointer:16                       id=6    [slave  pointer  (2)]
⎜   ↳ xwayland-relative-pointer:16              id=7    [slave  pointer  (2)]
⎜   ↳ xwayland-pointer-gestures:16              id=8    [slave  pointer  (2)]
⎣ Virtual core keyboard                     id=3    [master keyboard (2)]
   ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
   ↳ xwayland-keyboard:16                      id=9    [slave  keyboard (3)]

How can I disable middle click with Wayland protocol?

2
  • 3
    Facing the same issue. Did you find a solution?
    – IttayD
    Commented Jun 16, 2022 at 4:24
  • For gnome: gsettings set org.gnome.desktop.peripherals.touchpad middle-click-emulation true Commented Jul 5, 2022 at 3:46

4 Answers 4

9

Solution

Use the command:

gsettings set org.gnome.desktop.peripherals.touchpad middle-click-emulation true

When we enable middle click emulation, if there is a real middle button on your touchpad he'll be disabled. You don't need to put it into your .bashrc to keep it persistant. Here is the property description. You can customize it using dconf-editor gui (faster than command line)

If you don't know what dconf is.

Why it wasn't working anymore

Wayland use libinput is instead of xinput. Therefore, you won't be able to change settings with xinput anymore. Libinput on wayland More informations on libinput documentation

Bonus: Exploring /dev/input

I found this very interesting tutorial explaining how to explore input devices.

Here is some python3 code to discover mouse input:

import struct
f = open( "/dev/input/mouse0", "rb" );
while 1:
  data = f.read(3)                 # Reads the 3 bytes
  print(struct.unpack('3b',data))  # Unpacks the bytes to integers

Save it into a file.py and run sudo python3 file.py

4
  • Then you shouldn't have the problem and fixing it using: xinput set-prop 'your device' 'libinput Middle Emulation Enabled' 1. Commented Jul 6, 2022 at 17:47
  • This solution doesn't work. Thinkpad L14, Ubuntu 22.04 Commented Oct 3, 2022 at 9:59
  • Solution DOES work on Ubuntu 22.04 on HP laptop. Annoying middle button is gone.
    – igor
    Commented Apr 11, 2023 at 12:06
  • @TomaszGiba, I think because the device had a different name?!? I am also looking for a solution to disable the middle button function on the trackpoint T570
    – Stephan
    Commented Jun 15 at 13:13
1

you can disable the middle button on the trackpoint by creating a new file under:

/usr/share/libinput

with a name like

99-trackpoint.quirks

and input:

[Lenovo Trackpoint]
MatchName=*TPPS/2 IBM TrackPoint*
AttrEventCode=-BTN_MIDDLE

You can see the change with:

sudo libinput quirks list /dev/input/event5

Name and event ID can be found with:

sudo libinput list-devices

After a reboot the middle button is disabled, but also the scrolling does not work anymore. So it is not a real solution for me.

0

I got this method from the Hyprland FAQ, and it works great!

wl-paste -p --watch wl-copy -p ''

It requires wl-clipboard to be installed.

1
  • This will disable the paste feature but not other effects of the middle click such as closing tabs
    – nstCactus
    Commented Jul 31 at 5:53
0

Based on Stephan's answer, I managed to do the same for my touchpad.

TL;DR

Put the following in /usr/share/libinput/99-disable-touchpad-three-finger-tap.quirks and reboot:

[Lenovo Touchpad]
MatchName=*SYNA8022:00 06CB:CE67 Touchpad*
AttrEventCode=-BTN_TOOL_TRIPLETAP

How I got those values?

Execute the following command to get find the device name and filename (respectively Device and Kernel in the output) : sudo libinput list-devices | grep Touch -A5

Device:           SYNA8022:00 06CB:CE67 Touchpad
Kernel:           /dev/input/event5
Group:            7
Seat:             seat0, default
Size:             112x57mm
Capabilities:     pointer gesture

Now using the evtest command, you can spy on what happens when user input takes place.

Execute the following command, do a three-finger tap and hit Ctrl+C to quit (brace yourself, it's verbose): sudo evtest --grab /dev/input/event5 | grep 'type 1'

Event: time 1722411407.126150, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1722411407.126150, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 1
Event: time 1722411407.131800, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 0
Event: time 1722411407.131800, type 1 (EV_KEY), code 333 (BTN_TOOL_DOUBLETAP), value 1
Event: time 1722411407.136574, type 1 (EV_KEY), code 333 (BTN_TOOL_DOUBLETAP), value 0
Event: time 1722411407.136574, type 1 (EV_KEY), code 334 (BTN_TOOL_TRIPLETAP), value 1
Event: time 1722411407.248579, type 1 (EV_KEY), code 333 (BTN_TOOL_DOUBLETAP), value 1
Event: time 1722411407.248579, type 1 (EV_KEY), code 334 (BTN_TOOL_TRIPLETAP), value 0
Event: time 1722411407.254840, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 1
Event: time 1722411407.254840, type 1 (EV_KEY), code 333 (BTN_TOOL_DOUBLETAP), value 0
Event: time 1722411407.261471, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1722411407.261471, type 1 (EV_KEY), code 325 (BTN_TOOL_FINGER), value 0

The interesting bit is Event: time 1722411407.136574, type 1 (EV_KEY), code 334 (BTN_TOOL_TRIPLETAP), value 1.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .