8

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?

1
  • I asked this in the irc and was told it was X server configuration.Am still to figure it out though. Jul 21, 2011 at 13:52

3 Answers 3

4

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
3

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.

1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .