Mapping Logitech Mouse extra buttons for gaming on Garuda

I thought this might be useful to other Garuda users so posting this here.

I wanted to remap mouse button bindings to work better for my gaming keybinds. Since the software provided by Logitech to remap their mouse buttons only works on Windows and Mac, you have to use something else. I had picked up a new M650L Logitech mouse last week that has two side buttons that default to page forward or page back. I wanted to use them for shift and ctrl.

For basic one click items, you can directly use xbindkeys. I also installed something with a gui called “input-remapper” which uses xbindkeys under the covers. However, I found that you can’t map mouse buttons to actually stay depressed with either of these options even though it works fine for a one time click of a key combination. If you need it to act like you were holding down a modifier while hitting another key, you won't be able to use xbindkeys despite their software seeming to imply you could use it this way (they have a function for holding keys).

Xbindkeys help was found here: Just remember that you can’t simulate a “modifier”, holding a key still only does one click, you can add delays and so forth, but that requires using the macro functionality which could easily be detected by anti cheating software and get your game character banned. Also, it was very inconsistent, could not count on the key being depressed when you wanted.

For being able to actually click a mouse button and have it act like a modifier button like shift or control, I found a solution in logiops which binds to the keycodes under the covers, has to run as an elevated user. Logiops is in the chaotic-aur.

logiops config /etc/logid.cfg, details below
xbindkeys See config at ~/.xbindkeysrc
xdotool maybe logiops using? Not sure.
xorg_xev used to see what outputs are being sent by input devices xev on cmd ln

Here is the configuration to make front left button act like right shift and the back left button act like right control. The cid’s used for the buttons came from the output of logid -v and to determine which button was which, I first mapped the one I suspected were correct to letters, then changed to the shift and control after knowing for sure which was which. Use this for any newer logictech mouse, I tried with some other mice too, but those don't work. Essentially, the mice that Logitech says use their remapping software should also work with this solution.

To find keycodes, see this link: linux/input-event-codes.h at master · torvalds/linux · GitHub
The cid codes are listed here: CIDs · PixlOne/logiops Wiki · GitHub validate the mouse you are using implemented the right ones with the letter map I used above.

Good info that led me to logiops solution was found here: Logitech MX Master - ArchWiki


devices: ({ 
name: "Signature M650 L Mouse"; 
//    /dev/hidraw6:255 

// A lower threshold number makes the wheel switch to free-spin mode 
// quicker when scrolling fast. 
smartshift: { on: true; threshold: 20; }; 

hiresscroll: { hires: true; invert: false; target: false; }; 

// Higher numbers make the mouse more sensitive (cursor moves faster), 
dpi: 1500; 

buttons: ( 

// back thumb button 8. 
{ cid: 0x53; action = { type: "Keypress"; keys: ["KEY_RIGHTCTRL"]; }; }, 

// front thumb button 9. 
{ cid: 0x56; action = { type: "Keypress"; keys: ["KEY_RIGHTSHIFT"];    }; } 


// output of logid -v for the logitech m650 L mouse 
//[INFO] Device Signature M650 L Mouse not configured, using default config. 
//[INFO] Device found: Signature M650 L Mouse on /dev/hidraw6:255 
//[DEBUG] /dev/hidraw6:255 remappable buttons: 
//[DEBUG] CID  | reprog? | fn key? | mouse key? | gesture support? 
//[DEBUG] 0x50 |         |         | YES        | 
//[DEBUG] 0x51 |         |         | YES        | 
//[DEBUG] 0x52 | YES     |         | YES        | YES 
//[DEBUG] 0x53 | YES     |         | YES        | YES 
//[DEBUG] 0x56 | YES     |         | YES        | YES 
//[DEBUG] 0xd7 | YES     |         |            | YES 

// using xev to see the outputs from pressing the buttons (run xev, put cursor over box, press buttons) 
// Left side button towards front of mouse, button 9 
//ButtonPress event, serial 41, synthetic NO, window 0x4200001, 
//root 0x94e, subw 0x0, time 2129337, (105,143), root:(1936,1280), 
//state 0x10, button 9, same_screen YES 

//ButtonRelease event, serial 41, synthetic NO, window 0x4200001, 
//root 0x94e, subw 0x0, time 2129362, (105,143), root:(1936,1280), 
//state 0x10, button 9, same_screen YES 

// Left side button towards back of mouse, button 8 
//ButtonPress event, serial 41, synthetic NO, window 0x4200001, 
//root 0x94e, subw 0x0, time 2152801, (105,143), root:(1936,1280), 
//state 0x10, button 8, same_screen YES