First, identify your mouse's id
through the command xinput
. In this example, what we are looking for is the id=9
:
$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ PIXART USB OPTICAL MOUSE id=9 [slave pointer (2)]
Now, let's discover all the buttons available on your mouse and their order, using the command xinput --list <id>
, substituting <id>
for your mouse's id found earlier:
$ xinput --list 9
PIXART USB OPTICAL MOUSE id=9 [slave pointer (2)]
Reporting 7 classes:
Class originated from: 9. Type: XIButtonClass
Buttons supported: 7
Button labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right"
Now we know how many buttons are supported, and their order, given by "Button labels". In the example, "Button Left" is 1
, "Button Middle" is 2
, and so on.
I don't know the exact order of the buttons of your mouse, as you should discover it as described above. But suppose your "Back button"
's number is 6 and "Forward button"
's number is 7, and there are 11 buttons supported. Run this command, substituting <id>
for your mouse's id:
xinput set-button-map <id> 1 2 3 4 5 7 6 8 9 10 11