0

My operating system is Ubuntu 20.04.6 LTS (Focal Fossa) 64-bit, with Kernel Linux 5.15.0-107-generic x86_64 and MATE 1.24.0. Generally, I use a mouse with 3 real, physical buttons (a left, a middle, and a right one). Today, I have seen that the middle button does not work properly any more, probably as a consequence of an update.

I have noted this using xfig and trying to "glue objects into a compound object". This is done in xfig using the middle button to enclose in a rectangle all the items we have to join and finally pressing the right button. Unfortunately, the middle button does not work properly any more: instead of selecting the objects, it vertically shifts the image.

In other words, instead of working as a proper middle button (or as a mouse with a wheel if we press the wheel as it were a button), it works as a mouse with a wheel if we rotate the wheel. How can I solve the problem? Please consider that I use alternatively a mouse with a wheel (which is still working as usual) and therefore, if possible, I would prefer a solution which allows to use both of them without too many changes when I swap between the two.

1
  • If you have solved your problem, post an answer instead of editing the question
    – muru
    Commented Jun 11 at 1:39

1 Answer 1

0

There are two alternative solutions which seem to work.


I. Use xinput command to disable the unwanted behavior, in this way:

Search for the name or numerical identifier of the device with the command xinput list (in my case, the name was 'Logitech Optical USB Mouse' with id=8), then ask for the options available for the device with xinput list-props ... (replace ... with the name or the id of the device: in my case 'Logitech Optical USB Mouse' or 8), then (as root) give (from the terminal) the command xinput set-prop ... "libinput Button Scrolling Button" 0 (replace ... with the name or the id of the device: in my case 'Logitech Optical USB Mouse' or 8) to disable the scrolling behavior (attributing the button with number 0 means disabling the function).

The problem of this approach is that at each reboot or unplug/replug of the mouse the original behavior of the mouse is restored, and thus the command should be run again from the terminal.

This can be partially solved (only for the case of reboot) putting the command in Startup Applications in this way:

Open Startup Applications with the command gnome-session-properties and add a new application (for example, named 'mouse middle button') containing the command xinput set-prop ... "libinput Button Scrolling Button" 0 (replace ... with the name or the id of the device: in my case 'Logitech Optical USB Mouse' or 8).

II. The alternative solution, which at the moment seems to solve all the problems, is to disable the scrolling behavior from xorg, going into the /usr/share/X11/xorg.conf.d directory (the path could be different in your system) and (as root) editing the file 40-libinput.conf adding (inside the Section "InputClass" with Identifier "libinput pointer catchall") the two lines:

Option "ScrollMethod" "button"
Option "ScrollButton" "0"

I suggest you to make a backup of the file before editing it in such a way as to be able to easily recover in case of possible issues.

In my case, after editing, this section reads like this:

Section "InputClass"
     Identifier "libinput pointer catchall"
     MatchIsPointer "on"
     MatchDevicePath "/dev/input/event*"
     Option "ScrollMethod" "button"
     Option "ScrollButton" "0"
     Driver "libinput"
EndSection

Links:

How to make xinput settings persist after devices are unplugged, replugged, and after shutdown, restart, etc?

https://help.ubuntu.com/stable/ubuntu-help/startup-applications.html.en

https://www.reddit.com/r/hyprland/comments/1acqgnd/how_do_i_enable_a_scroll_button/

You must log in to answer this question.

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