How to switch Karabiner profile via shortcut

keyboardshortcut

Is there a way to change the Karabiner profile (formerly KeyRemap4MacBook) using a shortcut?

Best Answer

Yes, there is, using Karabiner's command-line tool. Paste this into your private.xml:

<vkopenurldef>
    <name>KeyCode::VK_OPEN_URL_SHELL_switchprofile_newitem</name>
    <url type="shell">
        <![CDATA[    /Applications/Karabiner.app/Contents/Library/bin/karabiner select_by_name NewItem    ]]>
    </url>
</vkopenurldef>
<item>
    <name>Switch Profile to NewItem with F4</name>
    <identifier>private.switch1</identifier>
    <autogen>
        __KeyToKey__
        KeyCode::F4,
        KeyCode::VK_OPEN_URL_SHELL_switchprofile_newitem
    </autogen>
</item>

Obviously, you will need to change the name of the profile (here it is NewItem).

If you want to toggle between them with a single hotkey, paste it twice and change the name, then check the box for the profile you want to switch to on each one.