Remapping mouse buttons

From froelix.com - Wiki
Jump to: navigation, search

Get a list of all your input devices:

$ xinput list
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ Logitech Unifying Device. Wireless PID:4026	id=8	[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)]
    ↳ AT Translated Set 2 keyboard            	id=9	[slave  keyboard (3)]

Remap the desired device buttons by using either the device id or the device name:

$ xinput --set-button-map 8 1 2 3 4 5 8 9 6 7
$ xinput --set-button-map "Logitech Unifying Device. Wireless PID:4026" 1 2 3 4 5 8 9 6 7

This example swaps the functionality of the scroll left/right buttons and the back/forward buttons.

Notes:

  • To make the remapping permanent, create an executable script which executes the above command and add it to the autostart ([1]).
  • For more details, see [2]