Multi-Button Mouse and Linux Mint

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search

The goal of this article is to address the USB mouse which has more than the typical three buttons and how to configure the additional buttons under Linux Mint/Ubuntu/Debian. The article is Mint centric however should apply to Ubuntu and to some degree the base distribution of Debian.

Problem and Goals

Goals:

  1. Disable extra macro buttons on a multi-button mouse -or-
  2. Program macros for extra buttons on a multi-button mouse.

The Problem:

The problem is specifically, in Mint Linux, this nearly absolutely useless developer lazy mouse control applet interface:

Completelyuselessmintlinuxlazydevinterfaceformouse.jpg

People have several complaints about this mouse control interface including the inability to properly control the mouse sensitivity and acceleration. However, our issue today is that it in no way addresses mouse button behavior and has no facility for additional buttons, such as those on the side of the mouse.

Some users complain about the default behavior of the side mouse buttons. Mint offers nothing in this mouse applet to disable the extra buttons or change their behavior.

Diagnostics Tools

If you would like to see if the extra buttons are detected and functional run the following:

xev -event button

This will open a program that will dump to console activity from each button as you click. If there is no output activity then the button is not detected or perhaps not functional.

The left mouse button should be detected as button 1, the right mouse button as button 3 and the middle scroll wheel or button when pressed as button 2. Mouse scroll wheel activity seems to be 5 and 6. Buttons 7 and above are the side buttons and other extra buttons on the mouse.

Disable side buttons and other extra buttons on a multi button mouse

Mint and Ubuntu support hot-plugging / hotplugging

To disable the extra mouse buttons on Linux Mint you can use xinput. Open a terminal and run xinput list to identify your mouse device name or ID. Then, use xinput get-button-map [device name or ID] to see the current button mapping. To disable the extra buttons, remap them to 0 using xinput set-button-map [device name or ID] 1 2 3 0 0 ..., replacing 1 2 3 with the mappings for left, middle, and right buttons, and setting the extra buttons to 0. Adjust the number of 0s to match your mouse's button count.

A working example for a specific mouse by Dragon. The following command will disable all but the three mouse buttons on top of the mouse.

xinput set-button-map "PixArt Gaming Mouse" 1 2 3 0 0 0 0 0 0

Now only the three buttons are function. Caveat is that your scroll wheel is now disabled too, no mouse scrolling with the wheel up or down. The scroll wheel acts as a third button but will not scroll.

Lets try a variation that will disable two side buttons and leave the mouse scroll wheel alone:

xinput set-button-map "PixArt Gaming Mouse" 1 2 3 4 5 0 0 0 0

These examples will work with common 5 button mice however your mouse will probably have a different device name other than "PixArt Gaming Mouse" - even though this device name is broad and covers several different mice from different manufacturers.

It looks like 4 and 5 are scroll up and down when using the mouse wheel when testing with Firefox. However, other applications still scroll up and down via mouse wheel even when 4 and 5 are both set to 0. The behavior of the button setting via xinput seems to be dependent on the application. It is a problem with Firefox.

Your best best is to use a combination of "xev -event button" and different xinput set-button-map trials until you achieve the behavior that you like. Do not use Firefox for testing the results. Most other applications behave correctly.

Note that the default mouse behavior will be restored after a reboot.

Program side buttons and other extra buttons on a multi button mouse

Some examples

Using xmodmap

xmodmap -e "pointer = 1 2 3 4 5 0 0 8 9 10 11 12 13"

External References

Related