eliminate mouse wheel clicks

July 14th, 2007

As much as the mouse wheel was a good idea, making it a clickable button was a *bad* idea. The mouse wheel is more sensitive than the left and right buttons, and it has too many jobs. Newer mice also do horizontal scrolling, which makes it even more flexible. Pushing down the mouse wheel to click has always been uncomfortable, for the simple reason that it *moves* in other directions beside down, it's not static.

When the mouse wheel was introduced, it was de facto a third button, and so the "natural thing" was to just make it that, adding to the scrolling functionality. Of course, the old Unix standard of mice also had three buttons, so that fits.

This button is important, because it's the Unix paste button, you use it all the time. In addition, Firefox made it its own, for opening links in tabs and for closing tabs. It has always bugged me that I had to use the mouse wheel button for that. Not enough to actually do something about it, but enough to bother me. :lazy:

So today I got the Logitech MX 400, where the mouse wheel button is actually harder to press in, and I decided to finally fix the problem. So here's what you do.

First you should know how many buttons your mouse has. You count every button, you also count scrolling (back, and forth, each count as a button). For example, my mouse has 9; the front two, a mouse wheel with 4 directions of scrolling, the mouse wheel button, and two side buttons. If you have some extra side buttons to use, you can use one of these as the paste button.

But you need to know which is which. Here's how:

$ xev

ButtonRelease event, serial 29, synthetic NO, window 0x2c00001,
root 0x61, subw 0x0, time 8209381, (102,133), root:(946,186),
state 0x100, button 1, same_screen YES

Here I started up xev, which brings up a little window. It prints lots of output about mouse and keyboard activity. When I move the pointer into the window and click, I get a piece of output like the above. Here I clicked the left front button, which is called button 1. In the same way, I find out that the mouse wheel button is number 2. While the side button I want to use as paste button is number 8.

Knowing this, I can remap the two buttons, switch their positions. Like so:

xmodmap -e "pointer = 1 8 3 4 5 6 7 2 9"

Here the numbers are sequential, except that 2 and 8 are swapped. Run this while X is running and you get the desired effect.

To make this permanent, you need to add it to your X session script. KDE is not very nice, because it doesn't give you an easy way to do it, so I just added the line to the startkde script (ugly hack):

...

xmodmap -e "pointer = 1 8 3 4 5 6 7 2 9"
# finally, give the session control to the session manager
# see kdebase/ksmserver for the description of the rest of the startup sequence
...

:: random entries in this category ::

2 Responses to "eliminate mouse wheel clicks"

  1. erik says:

    "This button is important, because it’s the Unix paste button, you use it all the time. In addition, Firefox made it its own, for opening links in tabs and for closing tabs."

    I actually never use it for any of those functions. I rarely even use it to scroll. It might as well not be there.

  2. numerodix says:

    I believe they call that elective surgery ;)