Inverting mouse axis using Karabiner

Karabiner seems like an extremely versatile piece of software, but I can't seem to find a way to invert the mouse axis with it. For example: When I move the mouse downwards I want the cursor to go upwards, and when I move the mouse to the right, I want the cursor to go left.(*)

Right now I'm using USB Overdrive for this purpose, but I need Karabiner for other stuff, and it would be nice if I could get away with just one program.

(*) This sounds so strange that I feel I owe you an explanation: I have a trackball mouse which, due to it's form factor forces me to turn it 180 degrees on my desk. By inverting the axis in software, it still moves naturally.


Solution 1:

To flip cursor movement you can use a third party tool: Karabiner. Karabiner isn't compatible with Sierra at the time of writing (January 2017).

  1. Download, install and open Karabiner
  2. Open in the menulet Karabiner -> Preferences
  3. Open the tab Misc & Uninstall
  4. Hit the button Open private.xml
  5. Open the file private.xml with an appropriate editor
  6. Enter the customized keycode

    <?xml version="1.0"?>
    <root>
        <item>
        <name>3rd-Party Pointing Device</name>
        <item>
            <name>Reverse Vertical &amp; Horizontal Cursor Movement</name>
            <identifier>reverse.mouse.movement</identifier>
            <autogen>
              __FlipPointingRelative__
              Option::FLIPPOINTINGRELATIVE_HORIZONTAL,
              Option::FLIPPOINTINGRELATIVE_VERTICAL,
            </autogen>
        </item>
        </item>
    </root>
    

    If you already have other items in private.xml omit the first two and the last line of the above code.

  7. Save the file

  8. Open in the menulet Karabiner -> Preferences the tab Change Key
  9. Hit the ReloadXML button
  10. Enable the remapping. It should be listed at the beginning.

enter image description here


If you have a second pointing device (i.e. an Apple mouse or a trackpad) and want to use it normally, you have to restrict the mod to your trackball mouse by adding a devicevendordef/deviceproductdef somewhere and a device tag after the identifier tag in your private.xml. Example (sorry, only an Apple external keyboard):

<devicevendordef>
    <vendorname>Apple</vendorname>
    <vendorid>0x05ac</vendorid>
</devicevendordef>
<deviceproductdef>
    <productname>ExternalKeyboard</productname>
    <productid>0x0256</productid>
</deviceproductdef>
...
<device_only>DeviceVendor::Apple, DeviceProduct::ExternalKeyboard</device_only>

You get the various device IDs by opening Karabiner > Misc. & Uninstall > EventViewer > Devices