Ubuntu – Disabling middle mouse button

mouse

So I tried looking through the various other questions but they mostly focus on disabling the middle mouse paste.

Basically the middle mouse button on my Logitech G500s is broken, and it keeps "clicking" randomly so it's screwing up any chance of doing work.

Is there any way to disable it? Or map it to nothing?

Thanks and sorry if this is a duplicate.

xinput list output:

⎡ Virtual core pointer id=2 [master pointer (3)]
⎜   ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜   ↳ Turtle Beach Turtle Beach PX3 (XBOX) id=8 [slave pointer (2)]
⎜   ↳ Logitech G500s Laser Gaming Mouse id=9 [slave pointer (2)]
⎜   ↳ Logitech G500s Laser Gaming Mouse id=10 [slave pointer (2)]
⎜   ↳ Razer Razer DeathStalker id=12 [slave pointer (2)]
⎜   ↳ Razer Razer DeathStalker id=13 [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)]
    ↳ Razer Razer DeathStalker id=11 [slave keyboard (3)]

Best Answer

Execute those commands:

xinput set-button-map 9 1 0 3
xinput set-button-map 10 1 0 3

Explanation (kindly donated by @Yehosef):

The first number is the identifier of the pointer (you'll often only have one, in this case there were two, 9 and 10).

The next numbers are what you do with the first, second, and third (ie, left, middle, right) mouse buttons. 1 0 3 tells it that the left button should do a left click (action 1), the middle button should do nothing, and the right button should do a right click (action 3). If you want to make the middle button also do a left click you could use 1 1 3. If you wanted to switch the right and left actions you could use 3 0 1. See https://wiki.ubuntu.com/X/Config/Input for more info.

Related Question