Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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
share|improve this answer
    
That's what I've thought. Anyway, thanks for nice reply ;) –  egis Dec 26 '12 at 23:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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