3

Due to an injury, I am using a left hand mouse and the buttons are reversed. My right hand mouse (a trackball) I still use for more precise work with my injured hand, but the buttons are reversed on that one too. I would like the right mouse to have normal button config and left mouse to be reversed, but not both. How can this be done? I am running Linux Mint 20.1 kernel 5.4.0.90.

In other words, I would like to have an ambidextrous mouse config, a left and right mouse, both with the primary click assigned to the index finger location. Any input appreciated.

2
  • mouse hardware hack would work Commented Nov 10, 2021 at 21:26
  • True, but there is a software way of doing this. The OS sees a distinction between the touchpad and the external mouse I'm sure by hardware ID and you can have different settings between the two except with regards to left/right handed--it's applied globally. So technically I have three mice with two config profiles where one profile is for both external mice, the other profile is for the touchpad, and the left/right setting is global. There may be a tweak application available for this that is able to apply a settings profile to a particular mouse ID. I will probably have to run two drivers Commented Nov 11, 2021 at 0:09

1 Answer 1

3

First, figure out the ID of each mouse using xinput (the output should look similar to below).

~ %> xinput ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ G2Touch Multi-Touch by G2TSP id=9 [slave pointer (2)] ⎜ ↳ Elan Touchpad id=10 [slave pointer (2)] ⎜ ↳ Elan TrackPoint id=11 [slave pointer (2)] ⎜ ↳ USB OPTICAL MOUSE id=16 [slave pointer (2)] ⎜ ↳ USB OPTICAL MOUSE Keyboard id=14 [slave pointer (2)] ⎜ ↳ PixArt Gaming Mouse id=17 [slave pointer (2)] 

If you can't differentiate your mice by name, try xinput disable [id] (and re-enable using xinput enable [id]) to determine which is which.

In this example, I have two mice connected, with IDs of 14 and 17.

Once you have the IDs, you can run

xinput set-button-map [id] 3 2 1 

to reverse the button functions of a mouse with a certain id.

If you wish to return your mouse to normal, run

xinput set-button-map [id] 1 2 3 

You can make the changes persistent on startup by putting the xinput set-button-map [id] 3 2 1 line in your ~/.bashrc

3
  • 1
    You are a gentleman and a scholar. Worked like a charm. I imagine you can also run the command as a startup item with parameters. Thank you Commented Nov 11, 2021 at 3:05
  • 1
    gentle*person, I shouldn't assume. Old habits die hard, my apologies if made any offence Commented Nov 11, 2021 at 4:07
  • 1
    Just wanted to update that placing the command in Startup Applications using the "custom command option" works with no issue through multiple reboots. Commented Nov 15, 2021 at 1:41

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.