reassign mouse buttons
Mon, 2008-02-18 16:58
My mouse has lots of buttons. Using xev I found their numbers:
left, right: 1,3 (of course)
wheel: press-2, scroll-4,5 (of course)
left side: 8,9
right side: 4,5 (huh? where's 6 and 7 then?)
Now I'm using a program (acme) in which pressing 1 and 3 together means something else than pressing 2, so I would like to move 2 to something else than the scrollwheel (pressing scrollwheels a lot is guaranteed to give you RSI).
I would very much prefer this layout:
left, right: 1,3
wheel: press-2, scroll-4,5
left side: 2,2
right side: 2,2
How do I make X do this?










You can reorder buttons with xmodmap:
xmodmap =e "pointer = a b c d e f g h i"You could also turn of Emulate3Buttons (or what the option was called), as I doubt that you actually use that much, which would fix the problem. (I myself never have it turned on seeing as I always use >=3 button mice)
Thanks, I will try that.
By the way, my laptop also has a built-in touchpad. The buttons on that are numbered as follows:
left, right: 1, 3
north, east, south, west: 1, 8, 3, 2 (little sense in that)
Maybe this is a problem?
As a quick guess I added this to the mouse inputdevice section of my xorg.conf:
Option "Buttons" "9"Didn't help.
Got it now:
xmodmap -e 'pointer = 1 9 3 4 5 6 7 8 2'swaps button 2 and the most easy to use side button.This is not quite what I want, since buttons 8 and 9 are actually sides of one button, and it's hard to feel which part you are pressing. Buttons 6 and 7 still don't exist.
Ignore all the button numbers above, I have switched both my mice to the evdev driver, and now they have these more sensible numbers:
touchpad:
left, right: 1, 3
n, e, s, w: 17, 20, 18, 19
mouse:
left, right: 1, 3
press wheel: 2
wheel: 4, 5
right side: 4, 5 ( = vertical scroll)
left side: 6, 7 ( = horizontal scroll)
Now I would like to do this:
xmodmap -e 'pointer = 1 2 3 4 5 2 2 8 9 10 11 12 13 14 15 16 4 5 2 2'but that of course still gives the same error.
Oh great, fix one thing, break another:
Because I now configured two evdev mice on two /dev/input/event# devices instead of one "auto" mouse on /dev/input/mice, I get swapped device names. When I wrote my xorg.conf, they were on event7 and event8, now the one that was on event7 (the touchpad) is on event6, and something called "Video Bus" is on event7. This way, each time I switch on my computer I will have one, two, or no working mice!
But at least they will be non-working mice with sensible button numbering.
I tried to solve the changing device name problem by using the "Phys" option in xorg.conf (see here what that is and why I'm not trying to use udev rules)... and then I had no mice at all. Same for using the product names.
Looking around on the net, I noticed that maybe the options aren't called "Phys" and "Name", but "Dev Phys" and "Dev Name". Going to try "Dev Name" now...
... nope, that doesn't work either. Well, back to the good old mouse/auto driver and /dev/input/mice then, with its slightly odd button layout.