Linux/Unix X11 Mouse Button Numbering Scheme

Perm url with updates: http://xahlee.org/kbd/X11_mouse_button_numbering.html

Linux/Unix X11 Mouse Button Numbering Scheme

Xah Lee, 2011-05-28

For some odd reason, if you have a 5-button mouse, the 5th button (aka “forward button”) in emacs has syntax <mouse-5> in Windows and Mac, but on Ubuntu 10.04 Linux running Gnome 2.x, it's <mouse-9>.

In unix X11, here seems to be how they assign the mouse buttons.

  • 1 = left button
  • 2 = middle button (pressing the scroll wheel)
  • 3 = right button
  • 4 = roll scroll wheel up
  • 5 = roll scroll wheel down
  • 6 = push/tilt scroll wheel left (some mouse only)
  • 7 = push/tilt scroll wheel right (some mouse only)
  • 8 = 4th button (aka backward button)
  • 9 = 5th button (aka forward button)

In emacs, you can find out the mouse button or wheel syntax by calling “describe-key” then press the button.

In X11, you can call “xev” to see any keyboard/mouse event and their naming.

Mouse Numbering on Windows and Mac

The numbering also depends on OS and mouse driver.

For example, on Mac OS X 10.4.x, using a Microsoft 5-buttons mouse, the numbering changes depending on whether you have Microsoft's mouse driver (IntelliPoint) installed.

Numbering Scheme on Mac OS X with Microsoft 5-buttons Mouse without IntelliPoint Software

If you don't have IntelliPoint installed, then Mac OS X doesn't register the mouse wheel tilt left/right, and your Backward (4th) button is the same as right-button, and Forward (5th) button is 4th button.

Here's the numbering reported by emacs's “describe-key”.

  • <mouse-1> = left button
  • <mouse-2> = middle button (pressing the scroll wheel)
  • <mouse-3> = right button
  • <wheel-up> = roll scroll wheel up
  • <wheel-down> = roll scroll wheel down
  • none = push/tilt scroll wheel left (some mouse only)
  • none = push/tilt scroll wheel right (some mouse only)
  • <mouse-3> = 4th button (aka backward button)
  • <mouse-4> = 5th button (aka forward button)

Popular posts from this blog

Browser User Agent Strings 2012

11 Years of Writing About Emacs

does md5 creates more randomness?