TL;DR

Install Seil and Karabiner.

Open Karabiner's Preferences -> Misc & Uninstall -> Open private.xml.

Set this as your file:

<?xml version="1.0"?>
<root>
    <item>
        <name>Home Row Arrow Keys: FN + IJKL to ^&lt;&gt;v</name>
        <identifier>private.coolaj86_fn_homerowarrows</identifier>
        <autogen>
            __KeyToKey__ 
            KeyCode::I,
            ModifierFlag::FN
            KeyCode::CURSOR_UP
        </autogen>
        <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>
    </item>

    <item>
        <name>Home Row Arrow Keys: COMMAND_L + SHIFT_L + IJKL to ^&lt;&gt;v</name>
        <identifier>private.coolaj86_cmd_shift_homerowarrows</identifier>
        <autogen>
            __KeyToKey__ 
            KeyCode::I,
            ModifierFlag::COMMAND_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_UP
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::J,
            ModifierFlag::COMMAND_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_LEFT
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::K,
            ModifierFlag::COMMAND_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_DOWN
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::L,
            ModifierFlag::COMMAND_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_RIGHT
        </autogen>
    </item>
</root>

Reload XML and then search in Karabiner for the Home Row settings and check the ones you like.

Why?

Hi, I'm AJ. I use a bluetooth Apple keyboard and recently my wrist has been bothering me because I've been using the arrow keys a lot, which are very inconveniently located - too close to my right hand to justify picking it up and moving it, too far to avoid repetitive wrist strain.

Over the years Ergonomics have become more and more important to me.

  • in high school, I switched to Dvorak.
  • in college I remapped my CapsLock to Delete.
  • about that same week I changed
    • Right Option to Esc
    • Right Command to Enter
  • Today I mapped
    • Backspace to Forward Delete (0x75 or 117) - so that I don't have to hit FN (which is a little bit of wrist strain) as often
    • Shift + Command + IJKL to Arrow Keys (which on Dvorak is CDTN)

Install Seil & Karabiner

I'm gonna teach you how to use FN, CapsLock, Command, or whatever plus IJKL, WASD, or whatever to put the arrow keys right at your fingertips.

First off, you're gonna need two programs:

  • Seil (previously PCKeyboardHack)
  • Karabiner (previously KeyRemap4MacBook)

Note: Karabiner will reset your Key Delay and Key Repeat rates to the default, but you can easily change them back on the Key Repeat tab.

Note: Karabiner maps FN + right hand to act as numpad by default. Turn this off by selecting Disable NumPad Hack.

IMPORTANT:

Do you fall into either of these categories?

  • you use anything non-Qwerty - Dvorak, Colemak, etc
  • you already use Seil for other keymappings

If so, pay attention in the next step. You need to test that the keycodes you think you're sending are the ones you're actually sending!

Open Karabiner's Event Viewer

Once Karabiner is installed, open up the EventViewer

Now try pressing some keys and watching what happens.

Try pressing fn. Try I. Try CapsLock.

Okay, now decide which key you want to map to Up Arrow. I chose SHIFT_L + COMMAND_L + C, so I tried them one at a time and here's what I saw:

eventTypecodenameflagsmisc
keyMod0x38Shift_LShiftKeyCode::SHIFT_L characters:
keyMod0x37Command_LCmdKeyCode::COMMAND_L characters:
keyDown0x22cKeyCode::I characters:c

Notice that I use Dvorak, so c shows up as KeyCode::I. Most people, however, will see KeyCode::I characters:i.

Set your layout in Karabiner's private.xml

Go to Preferences -> Misc & Uninstall and click the button Open private.xml. That will open the containing folder and you can then use SublimeText 2 or whatever you prefer to edit it.

Example: FN + I as Up Arrow

<?xml version="1.0"?>
<root>
    <item>
        <name>Home Row Arrow Keys: IJKL to ^&lt;&gt;v</name>
        <identifier>private.coolaj86_homerowarrows</identifier>
        <autogen>
            __KeyToKey__ 
            KeyCode::I,
            ModifierFlag::FN,
            KeyCode::CURSOR_UP
        </autogen>
        <!-- more defined below -->
    </item>
</root>

Example: Cmd_L + Shift_L + K as Down Arrow

<?xml version="1.0"?>
<root>
    <item>
        <name>Home Row Arrow Keys: IJKL to ^&lt;&gt;v</name>
        <identifier>private.coolaj86_homerowarrows</identifier>
        <!-- snip snip -->
        <autogen>
            __KeyToKey__ 
            KeyCode::K,
            ModifierFlag::COMMAND_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_DOWN
        </autogen>
        <!-- snip snip -->
    </item>
</root>

Test that it works

  1. Save your private.xml
  2. Navigate to Karabiner -> Prefences -> Change Key (the first tab)
  3. Click Reload XML
  4. Search for Home Row
  5. Check the checkboxes
  6. Test in a document and also look at the events in EventView

Common Problems

Just a few things to check first:

Using CapsLock and other Modifiers

If you decide to use CapsLock, you'll need to change your system settings.

System Settings
  Keyboard
    Keyboard
      Modifier Keys...
        Select Keyboard: *** REPEAT THESE STEPS FOR EACH KEYBARDS ***
        Caps Lock: **No Action**

There may be cases where it makes sense to turn off the functionality of other modifiers as well.

Using FN

Karabiner maps FN + right hand to numpad by default. Turn this off by selecting Disable NumPad Hack.

System Settings
  Dictation & Speech
    Dictation: Off
    Shortcut: Off

You could leave Dictation on, but you'd definitely need to change which key is the shortcut for it.

My private.xml

<?xml version="1.0"?>
<root>
    <item>
        <name>Home Row Arrow Keys: FN + IJKL to ^&lt;&gt;v</name>
        <identifier>private.coolaj86_fn_homerowarrows</identifier>
        <autogen>
            __KeyToKey__ 
            KeyCode::I,
            ModifierFlag::FN,
            KeyCode::CURSOR_UP
        </autogen>
        <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>
    </item>



    <item>
        <name>Home Row Arrow Keys: Cmd + Shift + IJKL to ^&lt;&gt;v</name>
        <identifier>private.coolaj86_cmd_shift_homerowarrows</identifier>
        <autogen>
            __KeyToKey__ 
            KeyCode::I,
            ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_UP
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::J,
            ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_LEFT
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::K,
            ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_DOWN
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::L,
            ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_RIGHT
        </autogen>
    </item>

    <item>
        <name>Home Row Arrow Keys: P,COMMA to &gt;,v</name>
        <identifier>private.coolaj86_p_comma_homerowarrows</identifier>
        <autogen>
            __KeyToKey__ 
            KeyCode::P,
            ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_RIGHT
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::P,
            ModifierFlag::FN,
            KeyCode::CURSOR_RIGHT
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::COMMA,
            ModifierFlag::FN,
            KeyCode::CURSOR_DOWN
        </autogen>
        <autogen>
            __KeyToKey__ 
            KeyCode::COMMA,
            ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L,
            KeyCode::CURSOR_DOWN
        </autogen>
    </item>
</root>

I also include P as right and COMMA as down because that's how the vim right and left map to qwerty from dvorak.


By AJ ONeal

If you loved this and want more like it, sign up!


Did I make your day?
Buy me a coffeeBuy me a coffee  

(you can learn about the bigger picture I'm working towards on my patreon page )



Published

2015-1-20



Buy me a coffeeBuy me a coffee


  73% of Goal Reached


Want more like this?