How to create a keybinding using the [fn] key as a modifier?

The half-size arrow keys on my MacBook are a little small for me. The keys I'd prefer to use are:

  • fn +  J  to move left
  • fn +  K  to move down
  • fn +  L  to move right
  • fn +  I  to move up

I badly want to use the "fn" key for this, both for ergonomic and practical reasons (ie: avoid conflicts with other apps).

Is this possible? How?


Solution 1:

I installed a third party utility to remap these keys on my MacBook Pro running OS X 10.8. Here are the steps I used:

(1) Download and install KeyRemap4MacBook.app

(2) Edit (or create) the following file in a text editor:

~/Library/Application Support/KeyRemap4MacBook/private.xml

...so that its content is:

<?xml version="1.0"?>
<root>
<item>
        <name>JKLI to Arrow Keys</name>
        <identifier>private.jkli_to_arrow_keys</identifier>
        <autogen>
            __KeyToKey__
            KeyCode::J, ModifierFlag::FN,
            KeyCode::CURSOR_LEFT
        </autogen>
        <autogen>
        __KeyToKey__
            KeyCode::K, ModifierFlag::FN,
            KeyCode::CURSOR_DOWN
        </autogen>
        <autogen>
        __KeyToKey__
            KeyCode::L, ModifierFlag::FN,
            KeyCode::CURSOR_RIGHT
        </autogen>
        <autogen>
        __KeyToKey__
            KeyCode::I, ModifierFlag::FN,
            KeyCode::CURSOR_UP
        </autogen>
</item>
</root>

(3) Select "Preferences" from the little KeyRemap4MacBook icon in the OS X MenuBar at the top of the screen.

KeyRemap4MacBook > Preferences

(4) In KeyRemap4MacBook's "Change Key" tab, tick "JKLI to Arrow Keys". (if this option doesn't appear, you may need to click the "ReloadXML" button)

KeyRemap4MacBook > Change Key

You should now be able to use the Function key with J|K|L|I to control the cursor, in addition to the Arrow keys.

Solution 2:

You are correct. Although Mac OS X allows you to remap the control, caps lock, option, and command keys, the fn key is not included. To do this, you'll need to use 3rd-party software such as DoubleCommand. That will let you remap the fn key to the control key.

From there, you should check out additional software to remap the control+J key etc. to emulate the left key etc. So long as you can emulate ctrl, you should be able to create the keybinding in ~/Library/KeyBindings. You might be able to do this last step in DoubleCommand as well.

Solution 3:

This is possible on macOS Catalina without any extra software by using System preferences -> Keyboard.

Hit the Modifier button, and you can now change the behaviour of your fn key to Caps Lock, Ctrl, Option, Command or Esc.

Interestingly, you cannot so easily modify any of those keys to act as the fn key.