How to disable the middle touchpad button completely in Fedora 32

This is kind of driving me crazy. I don’t mind having a middle mouse button, and while other people might disagree, to me it seems so wrong to have a middle touchpad “button”. Especially when 1) it’s super easy to accidentally “push” it, and 2) it does all sorts of destructive things like closing tabs in Firefox.

I’ve disabled the “middle click paste” in the gnome tweak tool, but that doesn’t seem to have fixed anything. The terminal still gets middle touchpad clicks, Firefox still gets middle touchpad clicks (and I’ve accidentally closed my gmail tab 3 times this morning), and when I check libinput debug-events, I’m still seeing BTN-MIDDLE.

How do I just comprehensively kill this thing dead? Do I have to recompile libinput? How is this supposed to work?

Hi @tedmiddleton, welcome to the community! Please take a minute to go through the introductory post in the #start-here category if you’ve not had a chance to do so yet. It includes information on how to use the forum effectively.

Did you have a look at xmodmap?

Hi rele - thanks for the link…

I’ve tried xmodmap and it doesn’t seem to work.

xmodmap is how I would have done this remapping in the xorg days, but with wayland, I don’t think xmodmap does very much - I would imagine that it would work for X-based programs like Chrome, but what about Firefox, and all the Gtk and Qt applications?

Are you talking about clickable areas on the touchpad or actual buttons? If it’s the former, you can exchange the clickable area for a three-finger press for middle click (and re-enable middle-click paste which is one of the most useful little quirks of linux).

If it’s an actual button, or if you don’t want anything to do with middle-clicking, you can try remapping it (to an empty keycode?) with a tool like these:

1 Like

That freedesktop link looks so promising - that libinput actually has a function called libinput_device_config_middle_emulation_set_enabled() that would let me turn off this madness for all devices:

… and it looks like at some someone merged code into mutter to call this:

… and it looks like it reacts to a touchpad setting “middle-click-emulation” - I’m assuming that this is under /org/gnome/desktop/peripherals/touchpad in dconf? But when I set /org/gnome/desktop/peripherals/touchpad/middle-click-emulation to true … nothing happens! Ack!

I wonder whether that change ever got merged into master in mutter?

If the tags are to be believed, this change has been in gnome since 3.36.1, and Fedora 32 is using 3.36.3.

So … I wonder what’s going wrong? I wonder if I need to restart mutter?

Well, I don’t know what middle-click-emulation does, but click-method=‘fingers’ seems to work ok - ideally I’d be able to left click with an area while turning off middle click altogether, but that doesn’t seem possible; with click-method=‘fingers’, at least I won’t be zapping firefox windows closed all the time. And I can adapt - my thinkpad has dedicated touchpad buttons too anyways.

The idea is that if you had a mouse without a middle button, you could still send middle click events, by clicking the left and right buttons simultaneously.

You can also find these settings in GNOME Tweaks, under “Keyboard & Mouse”. I can’t test this right now, but like you said, might be worth trying to log out and back in (or a reboot?). I don’t know if it’s something that can be changed on the fly or only during device enumeration. I have used the “fingers” setting and it works as expected, it’s difficult to accidentally do a three-finger tap.

1 Like

Yeah - middle-click-emulation doesn’t seem to do anything and it doesn’t exist in gnome-tweak-tool, but click-method works. It would have been ideal to still have click-method="area" and just kill the middle button somehow, but click-method="fingers" is ok too I guess. And it’s a lot less troublesome than patching and recompiling libinput.

Thanks, @alexpl, @rele . I think this is a pretty decent solution.


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.