July 11, 2013

Disabling side-click in Ubuntu

Aggravatingly, the "side" click, what you get if you squeeze the sides of your mouse (if your mouse supports it) is by default mapped to "back" in several browsers. Since squeezing your mouse is what you accidentally and subconsciously do when you pick up the mouse, this is almost never what you actually want. Helpfully, Ubuntu has deeply hidden away any means of configuring this behaviour.

With assistance from the OSM help board I found this post about fixing it, for which I've given an archive link because the current version of the site has taken it away (although search engines still index it....) Anyway, here's the short version:

  • Identify your mouse device. Type "xinput" in a terminal window. Mine is a "Mitsumi Electric Apple Optical USB Mouse".
  • Identify the offending click events. Run "xev" and click with the various buttons of your mouse: probably left and right click are "button 1" and "button 3" respectively, 2 is probably a click on the scroll wheel, and actually scrolling the scroll wheel will be other buttons (mine is omnidirectional, so that's buttons 4-7). And the side click: in my case button 8.
  • Go to the /usr/share/X11/xorg.conf.d directory.
  • Use sudo and your favourite editor to create a file with the contents
    Section "InputClass"
     Identifier "Side mouse button remap"
     MatchProduct "Mitsumi Electric Apple Optical USB Mouse"
     MatchDevicePath  "/dev/input/event*"
     Option "ButtonMapping" "1 2 3 4 5 6 7 0 0 0 0 0"
    except replace the product with your mouse device and in the ButtonMapping make sure you keep the buttons you use and zero out the correct side-click button for your device.
  • Restart X, or just reboot the machine.

Happy hacking!

"When we react out of fear, when we change our policy to make our country less open, the terrorists succeed---even if their attacks fail. But when we refuse to be terrorized, when we're indomitable in the face of terror, the terrorists fail---even if their attacks succeed." --Bruce Schneier

Posted by blahedo at 9:08pm on 11 Jul 2013
I actually like the side buttons and find them useful for browsing. To the point that I've been actively annoyed at the last few mice I've gotten (that don't have these buttons). Posted by eden at 9:51pm on 12 Jul 2013
The problem I kept having is that they would trigger when I was just picking up the mouse—they were very sensitive—and close a page I was using (which was especially a problem if the page had dynamic content of some sort). Also, the default button action ("back" in the browser) wasn't all that useful to me, as my browser workflow usually involves open-in-new-tab and closing tabs rather than a lot of back-and-forth. Posted by blahedo at 12:57pm on 12 Aug 2013
Post a comment

Is the year AD2021 in the future or the past?

Remember personal info?

Valid XHTML 1.0!