Skip to main content
Welcome guest. | Register | Login | Post

reassign mouse buttons

9 replies [Last post]
tbuitenh's picture
Offline
Joined: 2005-12-21

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?

free-zombie's picture
Offline
Joined: 2006-03-08
You can reorder buttons

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)

tbuitenh's picture
Offline
Joined: 2005-12-21
Thanks, I will try that.

Thanks, I will try that.

tbuitenh's picture
Offline
Joined: 2005-12-21
[tb@garden ~]$ xmodmap -e
[tb@garden ~]$ xmodmap -e 'pointer = 1 2 3 4 5 2 2 2 2'
Warning: Only changing the first 9 of 32 buttons.
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  116 (X_SetPointerMapping)
  Value in failed request:  0x2
  Serial number of failed request:  9
  Current serial number in output stream:  9
[tb@garden ~]$ xmodmap -e 'pointer = 1 2 3 4 5 2 2'
Warning: Only changing the first 7 of 32 buttons.
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  116 (X_SetPointerMapping)
  Value in failed request:  0x2
  Serial number of failed request:  9
  Current serial number in output stream:  9
[tb@garden ~]$ xmodmap -e 'pointer = a b c d e b b b b'
xmodmap:  commandline:1:  bad value a  given for buttons list
xmodmap:  1 error encountered, aborting.
[tb@garden ~]$ xmodmap -e 'pointer = 1, 2, 3, 4, 5, 2, 2, 2, 2'
Warning: Only changing the first 9 of 32 buttons.
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  116 (X_SetPointerMapping)
  Value in failed request:  0x2
  Serial number of failed request:  9
  Current serial number in output stream:  9

Sad !

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?

tbuitenh's picture
Offline
Joined: 2005-12-21
As a quick guess I added

As a quick guess I added this to the mouse inputdevice section of my xorg.conf:

Option "Buttons" "9"

Didn't help.

tbuitenh's picture
Offline
Joined: 2005-12-21
Got it now: xmodmap -e

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.

tbuitenh's picture
Offline
Joined: 2005-12-21
Ignore all the button

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.

tbuitenh's picture
Offline
Joined: 2005-12-21
Oh great, fix one thing,

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.

tbuitenh's picture
Offline
Joined: 2005-12-21
I tried to solve the

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...

tbuitenh's picture
Offline
Joined: 2005-12-21
... nope, that doesn't work

... 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.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.