Multi-button mouse on X11: How can I configure several buttons to act as the middle button?

5,383

Solution 1

I think you can configure the Option "ButtonMapping" in your mouse's Section "InputDevice" of xorg.conf. There you should set the physical button(s) to logical button 2.

E.g.:

Section "InputDevice"
  Identifier     "Mouse0"
  Driver         "mouse"
  Option         "Protocol" "auto"
  Option         "Device" "/dev/psaux"
  Option         "Emulate3Buttons" "no"
  Option         "ZAxisMapping" "4 5"
  Option         "ButtonMapping" "1 2 3 4 5 2"
EndSection

Solution 2

To make the left and right buttons act as the middle button when pressed together, you need to activate 3-button emulation. In older Xorg releases, set Option "Emulate3Buttons" "yes" in the appropriate InputDevice section of xorg.conf.

In Xorg 1.4 through 1.7, add a HAL configuration fdi file such as:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
  <device>
    <!--
         Default X.org input configuration is defined in:
             /etc/hal/fdi/policy/30user/10-x11-input.fdi
         Settings here modify or override the default configuration.
         See comment in the file above for more information.

         To see the currently active hal X.org input configuration
         run lshal or hal-device(1m) and search for "input.x11*" keys.

         Hal and X must be restarted for changes here to take any effect
    -->
    <match key="info.capabilities" contains="input.mouse">
      <merge key="input.x11_options.Emulate3Buttons" type="string">on</merge>
    </match>
  </device>
</deviceinfo>

In Xorg 1.8 and later, add a file in the xorg.conf.d directory such as:

Section "InputClass"
    Identifier "middle button emulation class"
    MatchIsPointer "on"
    Option "Emulate3Buttons" "on"
EndSection
Share:
5,383

Related videos on Youtube

dingzhihu
Author by

dingzhihu

I'm a software developer living in Switzerland. You can reach me at digulla at hepe dot com.

Updated on September 17, 2022

Comments

  • dingzhihu
    dingzhihu over 1 year

    I know how to make another button act as the middle button but how can I map several mouse buttons to the middle button?

    xmodmap complains if I repeat button numbers in the pointer option.

  • dingzhihu
    dingzhihu about 13 years
    My mouse has 18 buttons ... at least X says so. I could find only 7.