MacOS – Is it possible to toggle the trackball as a scroll wheel using Karabiner

macosmousescrolling

Is it possible to configure Karabiner (formerly keyremap4macbook) such that clicking the 3rd or 4th mouse button (on a trackball mouse) will toggle using the pointer to scroll?

Ideally I would like to be able to click the 3rd mouse button, after which moving the trackball will scroll (a webpage or whatever else is on screen), and will return to moving the cursor after the 3rd mouse button is pressed a second time.

I know it is possible to use the trackball as a scroll wheel while a key or mouse button is held down (see this answer), but that is not what I'm looking for. Thanks!

Edit: This is basically a request for a Mac version of the accepted answer to Remedy for a no scroll wheel trackball? which is only applicable to Linux.

Best Answer

Try putting this into your private.xml file. Select the top option (Toggle CursorMove -> ScrollWheel) in Preferences/Key Change tab and this will toggle the option below (using simultaneous press of trackball LEFT/RIGHT buttons). You could use KeyToKey instead of SimultaneousKeyPresses if you just want to use a single trackball button press.

<vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_SHELL_toggle_cursormove_scrollwheel</name>
    <url type="shell">
        <![CDATA[    /Applications/Karabiner.app/Contents/Library/bin/karabiner toggle private.pointing_relative_none_to_scroll    ]]>
    </url>
</vkopenurldef>

<item>
    <name>Toggle CursorMove -> ScrollWheel</name>
    <identifier>private.toggle_cursormove_scrollwheel</identifier>
    <autogen>
        __SimultaneousKeyPresses__
        PointingButton::RIGHT, PointingButton::LEFT,
        KeyCode::VK_OPEN_URL_SHELL_toggle_cursormove_scrollwheel,
    </autogen>
</item>

<item>
    <name>CursorMove -> ScrollWheel</name>
    <identifier>private.pointing_relative_none_to_scroll</identifier>
    <autogen>__PointingRelativeToScroll__ PointingButton::NONE</autogen>
</item>