
With my mouse, there are only 9 obvious physical buttons, but xinput reports 16. Type: XIButtonClassīutton labels: "Button Left" "Button Middle" "Button Right" "Button Wheel Up" "Button Wheel Down" "Button Horiz Wheel Left" "Button Horiz Wheel Right" "Button Side" "Button Extra" "Button Forward" "Button Back" "Button Task" "Button Unknown" "Button Unknown" "Button Unknown" "Button Unknown"

Logitech USB Laser Mouse id=11 Ĭlass originated from: 11. This may be different from the number of buttons that is apparent on the device. While you still know the ID of the device in this session, find out how many buttons the input handler thinks your mouse has, by using xinput list deviceID. Your mouse will have a different name figuring that out is left as an exercise for the reader. My mouse calls itself Logitech USB Laser Mouse and is shown as id=11. Below is some sample output from my laptop: ⎡ Virtual core pointer id=2 First, use xinput to discover the name that is assigned to your mouse, which is then correlated to an input device ID. You will need xinput installed for this task. Mapping Mouse Buttons to Other Mouse Buttons Though my aims were specific, the solutions below can be generalized to any situation in which you want to automatically remap mouse buttons at startup. I also wanted to map the bottom side button (#8) so that it executes a double-click of the left button (#1). So I wanted to automatically remap the top side button (#9 in this case) to the middle button (#2). I dislike this because I'm clumsy and typically end up scrolling the window I'm in when I try to click the wheel. In this case when I press the “button4” I simulate the shortcut CMD++ALT.I have a Logitech mouse with 9 buttons, and pressing the "middle button" (#2) involves clicking the scroll wheel. In this rule I had to add a condition, the rule works only if the frontmost application is different than Firefox. After I wrote this rule I discovered that it also works in the Finder but it does not work in Firefox because Firefox does not support this shortcut (I wrote a different rule for it). First of all, I wanted to use the “button4” to go back to the previous page in Safari.You can find the entire file in this Github repository.

Into this section of the JSON file, we have to add some rules to remap the mouse’s button.Īs an example, I’ll put here some snippets taken from my configuration. Into the karabiner.json file, we have to add some pieces of information in the “complex_modifications” field. As you can see from the image, using the Event Viewer you can precisely understand what happens when you press a button on your keyboard or on your mouse.
