Libervis Network - For a Free WorldLibervis.com :: Planet Libervis :: Nuxified.org :: MobiLiberty.com  |  IRC | powered by shopcentar.hr

reassign mouse buttons

 Submitted by tbuitenh on Mon, 2008-02-18 16:57.  
tbuitenh's picture
Posts: 1059
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?

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Mon, 2008-02-18 20:13  You can reorder buttons
free-zombie's picture
ModeratorWriters Team
Posts: 798
Joined: 2006-03-08

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)



 Tue, 2008-02-19 14:03  [tb@garden ~]$ xmodmap -e
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21
[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?

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Tue, 2008-02-19 14:23  As a quick guess I added
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

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

Option "Buttons" "9"

Didn't help.

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Tue, 2008-02-19 14:34  Got it now: xmodmap -e
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

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.

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Tue, 2008-02-19 10:01  Thanks, I will try that.
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

Thanks, I will try that.

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Tue, 2008-02-19 15:37  Ignore all the button
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

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.

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Tue, 2008-02-19 16:58  Oh great, fix one thing,
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

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.

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Tue, 2008-02-19 17:57  I tried to solve the
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

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

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



 Tue, 2008-02-19 18:10  ... nope, that doesn't work
tbuitenh's picture
Posts: 1059
Joined: 2005-12-21

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

--

CAN I HAS FIXD CAPSLOK KEE PLZ?



Comment viewing options

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

We have 1605 members who wrote 1957 articles and 11421 comments. Welcome to our newest member, stroisem!

Who's online

There are currently 0 users and 8 guests online.
About | FAQ | Goodies | Link | Contact | IRC
Nuxified RSS feed
Welcome >  |  Need help? Register here and ask away! | Show what's new