Karabiner F1 to Launch Defined Applications

keybindings

What is the coding to program my F1 key to launch an application that needs to be defined (like Notes) using Karabiner?

Best Answer

The coding is similar to your question here: Karabiner F1 to Launch Safari? You have to add a vkopenurldef tag though.

Some apps are already defined here:

/Applications/Karabiner.app/Contents/Resources/vkopenurldef.xml

After an update or an upgrade the file may be overwritten so customize your private.xml and add:

    <vkopenurldef>
        <name>KeyCode::VK_OPEN_URL_APP_Application</name>
        <url type="file">/Path/to/application</url>
    </vkopenurldef>
    <item>
        <name>F1 Application</name>
        <identifier>f1_application</identifier>
    <autogen>__KeyToKey__ KeyCode::F1, KeyCode::VK_OPEN_URL_APP_Application</autogen>
    </item>

Example:

    <vkopenurldef>
        <name>KeyCode::VK_OPEN_URL_APP_Notes</name>
        <url type="file">/Applications/Notes.app</url>
    </vkopenurldef>
    <item>
        <name>F1 Notes</name>
        <identifier>f1_notes</identifier>
    <autogen>__KeyToKey__ KeyCode::F1, KeyCode::VK_OPEN_URL_APP_Notes</autogen>
    </item>

Then enable it in Change Key. Depending on your settings (Consumer Keys or F1-F12 for the F-keys) in System Preferences -> Keyboard -> Keyboard -> F-key behavior you may have to hit the fn-key also.