Mouse buttons

From ArchWiki
Revision as of 19:56, 25 September 2005 by Shadowhand (talk | contribs) (How to set up XOrg to support more than 7 mouse buttons)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:I18n links start Template:I18n entry Template:Il8n links end

Patching XOrg

The first thing you need to do is patch XOrg to support evdev devices. There is a package in the AUR that has everything you need. (Please see ABS - The Arch Build System for more information on how to do this).

After XOrg-evdev has been installed, modprobe the evdev module.

 modprobe evdev

If everything is working, move on to the next section.

Setting Up Your Mouse

First we need to check to see which devices support the evdev protocol, so that we can configure XOrg properly.

 cat /proc/bus/input/devices

This should return something like this:

 I: Bus=0003 Vendor=046d Product=c01d Version=2100
 N: Name="Logitech USB-PS/2 Optical Mouse"
 P: Phys=usb-0000:00:10.0-2/input0
 H: Handlers=mouse1 event3
 B: EV=7
 B: KEY=ff0000 0 0 0 0 0 0 0 0
 B: REL=103

Note the event[X] in this line: H: Handlers=mouse1 event3. We will be referring to that line when we change our xorg.conf.

Setting Up XOrg

Now we need to edit the XOrg configuration ( /etc/X11/xorg.conf ) and add a new mouse. Open /etc/X11/xorg.conf with whatever editor you want and look for the "InputDevice" section. Copy and paste the following below your existing mouse section.

 Section "InputDevice"
         Identifier      "EvdevMouse"
         Driver          "mouse"
         Option          "Device"                "/dev/input/event3"
         Option          "Dev Name"              "Logitech USB*"
         Option          "Protocol"              "evdev"
         Option          "ZAxisMapping"          "11 12"
         Option          "Buttons"               "12"

You will have to edit this section accordingly. Change the "Device" line to match what you saw in the "Handlers" line. Chnage the "Dev Name" to match the "Name" line (use of wildcard (*) recommended). Change the "Buttons" to match what you have and change "ZAxisMapping" to match "Buttons" (ZAxisMapping refers to the last two buttons you have, so "4 5" for a 5 button mouse, "7 8" for a 8 button mouse, etc).

The last thing we need to do here is add the new mouse to the XOrg "ServerLayout" at the top of xorg.conf. Comment out the other lines that end with "CorePointer" and add a new InputDevice. When you're done, it should look something like this:

 Section "ServerLayout"
 	Identifier     "XOrg Configured"
 	Screen      0  "Screen0" 0 0
 	InputDevice    "Keyboard0" "CoreKeyboard"
 	InputDevice    "EvdevMouse" "CorePointer"
 	#InputDevice    "USB Mouse" "CorePointer"
 	#InputDevice    "PS/2 Mouse" "CorePointer"

Now we are almost done! The last thing we have to do is tell X how to use the new mouse buttons and possibly set up some user tools.

Post Configuration

If you use .xinitrc to load X, then add this to .xinitrc (change for the number of buttons you have):

 xmodmap -e "pointer = 1 2 3 6 7 8 9 10 11 12 4 5" &

Note that buttons 4 and 5 must go on the end or else your scroll wheel won't work.

If you use GDM/XDM/KDM instead of .xinitrc, then create the file ~/.Xmodmap and add this to it (change for the number of buttons you have):

 pointer = 1 2 3 6 7 8 9 10 11 12 4 5

You may have to play with these numbers a bit to get your desired behavior. Some mice use buttons 6 and 7 for the scroll wheel, in which case those buttons would have to be the last numbers. Keep playing with it until it works!

You can also check to see which buttons are being read with a program called 'xev', which is part of XOrg. When xev is run, it will show a box on your desktop that you can put the cursor into and click buttons to find out what buttons have been mapped.

User Tools

If you use a Logitech mouse, there is a tool called lmctl which will help you set the proper resolution, enable or disable smart scroll, etc. This tool is available in the Shadowhand repoisitory which is listed in the Unofficial user repositories .