7

I would like to map "Back" button (xev shows it as "button 7") of my mouse (A4Tech X-7) to act as a middle mouse button. Is there a way to do this? I'm lost in google, finding only how to map buttons to keyboard shortcuts with xbindkeys and etc.

  • OS: Centos 6.3 (x86_64)
  • DE: KDE 4.3.4

P.s. I can switch (with xmodmap) "Back" button with middle button with no problems, but is there a way to have both them act as a middle mouse button?

| improve this question | | | | |
5

You cannot map two physical buttons to the same logical button. All you can do is swap the buttons (echo 'pointer 1 7 3 4 5 6 2' | xmodmap -). This is a low-level limitation of X11. As stated in the documentation of XSetPointerMapping:

However, no two elements can have the same nonzero value, or a BadValue error results.

The best you can do is to use a program like xbindkeys to send a fake button 2 press when button 7 is pressed. In .xbindkeysrc:

"xdotool mousedown 2"
  b:7
"xdotool mouseup 2"
  b:7 + Release
| improve this answer | | | | |
  • That's what I've thought. Anyway, thanks for nice reply ;) – egis Dec 26 '12 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.