How can I set mouse as left handed on xmonad?
I had the mouse buttons inverted on Gnome, and I wanted to do the same on xmonad but I don't know how to do it. Does anyone knows what is the adequate configuration?
Solution 1:
You can change mouse settings in xorg.conf (if you have one) or by using xmodmap. For 3-button mouse xmodmap command should look like:
xmodmap -e "pointer = 3 2 1"
(first button acts like third, second as second and third like first)
If you have more buttons you may list actual config using:
xmodmap -pp
Solution 2:
You can configure that globally for X. Edit /etc/X11/xorg.conf
, find the InputDevice section for your mouse, that should begin with something like
Section "InputDevice"
Identifier "Mouse2"
Driver "mouse"
Option "Device" "/dev/input/mouse1"
(...)
and add
Option "ButtonMapping" "3 2 1 4 5"
somewhere within that section. The numbers in the second quote correspond to the buttons you have, so if you have only 3 button mouse, you'd only need to put
Option "ButtonMapping" "3 2 1"
an so on.
After that, of course, restart your X.
EDIT: Another way would be to add something like xmodmap -e "pointer = 3 2 1"
to your ~/.xinitrc
file (if you use startx) or at the end of /etc/X11/Sessions/Xsession
or /etc/X11/gdm/Xsession
.
Solution 3:
Here's a mouse-toggle-hand
script:
#!/bin/sh
(xmodmap -pp | grep -q "\b1\b *\b1\b") \
&& xmodmap -e "pointer = 3 2 1" \
|| xmodmap -e "pointer = 1 2 3"
It depends upon the output of xmodmap -pp
looking much like this:
There are 10 pointer buttons defined.
Physical Button
Button Code
1 3
2 2
3 1
4 4
5 5
6 6
7 7
8 8
9 9
10 10
That may or may not be reliable/portable, so YMMV.