Disabling the mouse scroll wheel left and right click for Ubuntu 10.10 E-mail
Thursday, 07 October 2010 20:30

If you've tuned in to the two previous installments of "disabling the scroll wheel side click", you'll see our villian exhibit a familiar pattern. Each release of Ubuntu introduces a change in the way that the mouse buttons are configured, though thankfully, this time, the changes are mininmal.

With Ubuntu 10.04, xorg.conf.d became the favoured way of configuring input devices, and it still is, however, the location of the xorg.conf.d file has been moved. Nice one!

The process is much the same as last time, though I'm going to go about it slightly differently because hal is no longer part of Ubuntu.

First of all, identify your pointing device.

xinput list

You should see something similar to this.

⎡ Virtual core pointer                        id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                  id=4    [slave  pointer  (2)]
⎜   ↳ Logitech USB RECEIVER                       id=8    [slave  pointer  (2)]
⎜   ↳ Logitech Logitech Illuminated Keyboard      id=10    [slave  pointer  (2)]
⎣ Virtual core keyboard                       id=3    [master keyboard (2)]
↳ Virtual core XTEST keyboard                 id=5    [slave  keyboard (3)]
↳ Power Button                                id=6    [slave  keyboard (3)]
↳ Power Button                                id=7    [slave  keyboard (3)]
↳ Logitech Logitech Illuminated Keyboard      id=9    [slave  keyboard (3)]

In my case, my input device is actually the third item, "Logitech USB Receiver", identified because it's under the pointer section and it has the device manufacturer name in it.

Next, create a config file in your xorg.conf.d folder which contains the rule to discard the button clicks you don't want ruining your day.

gksudo gedit /usr/share/X11/xorg.conf.d/20-middle-mouse-button.conf

Then paste the following into it.

Section "InputClass"
Identifier "Logitech middle mouse button remap"
MatchProduct "Logitech USB RECEIVER"
MatchDevicePath  "/dev/input/event*"
Option "ButtonMapping" "1 2 3 4 5 0 0 0 0 0 0 0"
EndSection

You can enter anything you like inside the quotes on the second line, but you'll need to put the product you found via xinput into the quotes on the third line.

Enter your button mapping into the second set of quotes on line 5, putting zeros in the position corresponding with the buttons you want to disable.

If you don't know what the button id's are, then run xev from a terminal window.

xev

With the mouse over the small window that opened up, click the scroll wheel left and right and you'll see a stream of events appear in the terminal window. One of the fields in the output includes the word button and next to it, you'll find the button id. The new Ubuntu has changed things up here as well, so you'll now only get one button id for both click and release. In my case, my left and right click id's are 11 and 12, so I need to put a 0 in the space for the 11th and 12th number in the ButtonMapping line of my config file. I've also gone ahead and put a 0 for everything after 5 as well, as these buttons don't do anything I care for on my mouse, so it didn't hurt.

After rebooting, your scroll wheel left and right click should do nothing!

blog comments powered by Disqus