Binding modifier key to mouse button 4 using KeyRemap4MacBook

keybindings

I'm wanting to do this so when I'm gaming I can use the mouse button as my modifier "shift" key instead of having to actually hit +1 or +2. This will prevent me from having to take my fingers off of the "1-4" or "Q-R" keys in order to modify them to +1.

Some notes:

  1. No Mouse Software Available from what I could fine.
  2. KeyRemap4MacBook doesn't have the ability to directly let me do it, so I was hoping there might be someone who could help me with the code needed to add it to the program.
  3. It doesn't just have to work for this mouse only as I'll essential always use it as a third shift key.
  4. I think a global remap might be best.

Best Answer

I have no idea how much difference there is between KeyRemap4MacBook and Karabiner (minus Karabiner Elements), so I can't guarantee that this will work on older versions. KeyRemap4MacBook got a name change to "Karabiner" in 2014 I believe, so some of the documentation may not apply to it anymore.

I only have access to mac with Sierra, so I couldn't test it in any version.

  1. Follow the instructions on how to add custom settings
    • Get back to this after you've completed step 3.
  2. Ignore step 4 and replace the contents of private.xml with:

<?xml version="1.0"?>
<root>

  <item>
    <name>Mouse Button 4 to Shift</name>
    <identifier>MouseBtn4ToShift</identifier>
    <autogen>
      __KeyToKey__
        PointingButton::BUTTON4,
        KeyCode::SHIFT_L
    </autogen>
  </item>

</root>

  1. Continue the instructions on how to add custom settings at step 5.

If you're not 100% sure that it's actually button number 4 that you're pressing, you can use the EventViewer to check.


Just incase someone is interested: