How to Make NumLock/Numpad Cursor Keys Work on External USB Keyboard

keybindingskeyboardukeleleusb

I have a Genius USB "partial" keyboard – a numpad like this one.

It types digits and +-/*, but doesn't switch to cursor mode with NumLock off, and Home/End/PgUp/PgDn keys were the reason I purchased it.

How do I make Home/End/other cursor keys work?

  • Sometimes USB keyboards don't work if Mouse Keys in Mouse Settings is on. Mine is off.
  • Sometimes hitting Clear key on the keyboard helps. I don't have it.
  • Ukelele doesn't have the numpad keys to edit.
  • Karabiner (ex KeyRemap4MacBook) doesn't have a ready feature for this.

The solution according to this answer seems to be Karabiner. Though, it looks pretty advanced and I didn't find it in half an hour.

Best Answer

Here's what I put in my private.xml file (using Karabiner.app), and it allows the following functionality:

Use a generic external numerical keypad with Mac OS X, and Num Lock on/off toggles number vs arrow/Home/End/PgUp/PgDn functionality. Num Lock light turns on/off as appropriate as well :-)

<?xml version="1.0"?>
<root>
    <item>
        <name>Toggle Numbers/Arrows</name>
        <identifier>private.toggle_numbers_arrows</identifier>
        <autogen>
            __KeyToKey__ KeyCode::KEYPAD_CLEAR, 
            KeyCode::VK_CONFIG_TOGGLE_remap_keypadnumlock, 
            KeyCode::VK_IOHIKEYBOARD_TOGGLE_NUMLOCK,
            KeyCode::VK_IOHIKEYBOARD_TOGGLE_NUMLOCK,
            KeyCode::VK_IOHIKEYBOARD_TOGGLE_NUMLOCK
        </autogen>
    </item>
</root>

As you can see, I needed to include the "...TOGGLE_NUMLOCK" three times to get the Num Lock LED status to appropriately indicate the state (otherwise it was backwards, whereas it would be lit for arrow functions and dark for numbers). Maybe there's a simple way to fix it, but the hack works perfectly for me. Hopefully someone else finds this useful!