I use a right-handed usb mouse in the office and a left-handed usb mouse at home on the same Ubuntu 11.04 laptop. How can I configure the one at home to be automatically set up to left-handed when plugged in?
1 Answer
Tutorial
Open up a terminal, and create a folder within your /etc/X11/ directory called xorg.conf.d and navigate to it:
sudo mkdir /etc/X11/xorg.conf.d
cd /etc/X11/xorg.conf.d/
Within this folder, make a file called 00-mouse-remap.conf, so bust open a text editor:
sudo gedit 00-mouse-remap.conf
The X Server should scan this directory for custom X11 scripts to load up at boot time. So the next step is to copy a config setting similar to this into the 00-mouse-remap.conf file you have just opened (customise to your will):
Section "InputClass"
Identifier "Microsoft Bluetooth Mouse 5000 button remap"
MatchProduct "Microsoft Bluetooth Notebook Mouse 5000"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "SendCoreEvents" "true"
Option "Buttons" "8"
Option "ButtonMapping" "3 2 1 4 5 0 7 0"
EndSection
Since this is mapped for a specific product, you should have separate configurations for your left and right handed mice. :P
You can find the name of your device by entering in to terminal:
xinput list
You will then need to edit a gnome configuration entry, so run (in terminal or type it into a run session using ALT+F2):
gconf-editor
(In case you have upgraded to a version that uses dconf, that is, 11.10 and everything later, run dconf-editor instead)
And navigate to this entry, and uncheck the box next to the entry that says active:
apps > gnome_settings_daemon > plugins > mouse
(In case of dconf, is org > gnome > settings_daemon > plugins > mouse)
Just be aware, that this disables the Gnome mouse pointer settings for when you modify your pointer settings within the GUI. So if you want to use the Mouse Settings GUI, you'll have to reactivate this - although, it could take over your new lefty settings. ^^
Examples
For example, my xinput list is:
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Acer T230H id=8 [slave pointer (2)]
⎜ ↳ Logitech USB Gaming Mouse id=9 [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)]
↳ Apple, Inc Apple Keyboard id=10 [slave keyboard (3)]
↳ Apple, Inc Apple Keyboard id=11 [slave keyboard (3)]
So I would configure my 00-mouse-remap.conf to look like so:
Section "InputClass"
Identifier "Logitech USB Gaming Mouse button remap"
MatchProduct "Logitech USB Gaming Mouse"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "SendCoreEvents" "true"
Option "Buttons" "8"
Option "ButtonMapping" "3 2 1 4 5 0 7 0"
EndSection
References:
-
Very interesting! Due to RSI symptoms started using an external (and symmetric) mouse with left-handed config, on my x41 thinkpad (where I love(d ?) my trackpoint)... Now I bought a handshoemouse (right-handed), but would like to continue using a left-handed (albeit cheap & symmetric) mouse, as well, so as to relieve my epicondylitis. For the IBM trackpoint I'm using configure-trackpoint. What I'm hoping for is this: I could continue using both my trackpoint as before and my new handshoemouse and - only for the cheap left-handed mouse - use the script you describe... Possible? Mar 29, 2012 at 16:23
-
Sorry for the late late reply :P I'd imagine you can (I haven't played with two at the exact same time, nor a trackpoint), so long as the identifiers are different I'm going to assume that the remap will apply to only the mouse you choose. Don't quote me on that though ^.^ Apr 21, 2012 at 11:59