Prevent extra mouse buttons from acting as forward / back in Firefox on Linux?

Solution 1:

I feel your pain. On my mouse, the accident-prone side buttons are 8 and 9 according to xev (4 and 5 are wheel scroll up/down). I use the following in my window manager startup script:

xinput set-button-map '<device name of mouse>' 1 2 3 4 5 16 17 18 19

By mapping buttons 6-9 to their original mapping + 10, they effectively become unbound to any default settings in any software that I'm aware of, but still output a usable value in case you want to deliberately enable them in software that allows custom mapping. If you just want to disable a button altogether, you can map it to zero. For more details, see man xinput(1).