7

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.

2
  • Mac doesn't have a Numlock at all, not even on an extended keyboard, so it's unlikely it can recognise when you're hitting it. You could try Key Codes & see what key is being recognised
    – Tetsujin
    Commented Dec 18, 2015 at 11:28
  • Thanks, will try that. I'd be happy if the keypad worked purely as cursor keys. Commented Dec 18, 2015 at 11:29

6 Answers 6

3

With the latest karabiner, there is a defined complex rule to enable this rather easily. You just need to import and enable these rules:

https://ke-complex-modifications.pqrs.org/#numpad

5

OS X does not understand 'Num lock'. There's no on-off state for Num lock in OS X and as such can be thought to be always on.

The Num lock button itself on a Windows keyboard is interpreted as Clear in OS X. You are able to bind this to actions in Keyboard Maestro, but a 'state switch' would essentially require saving a variable in Keyboard Maestro to be checked when a button is pressed, then intercepting the action and providing its own key press.

1
  • 1
    The device driver portions of macOS definitely do understand num lock - kHIDUsage_LED_NumLock is defined and works. github.com/damieng/setledsmac would not be able to set/unset/toggle the numlock key if it didn't.
    – DamienG
    Commented Jul 18, 2018 at 2:00
4

Following the idea explained in How do I remap a key in macOS Sierra, e.g., Right Alt to Right Control?, I enable the numlock cursor keys using the following script:

# Uses the keyboard usage IDs documented in https://developer.apple.com/library/archive/technotes/tn2450/_index.html.
# The lines below, respectively, map:
#   Keypad 2 and Down Arrow -> Keyboard Down Arrow
#   Keypad 4 and Left Arrow -> Keyboard Left Arrow
#   Keypad 6 and Right Arrow -> Keyboard Right Arrow
#   Keypad 8 and Up Arrow -> Keyboard Up Arrow
#
#   Keypad 1 and End -> Keyboard End
#   Keypad 3 and Page Down -> Keyboard Page Down
#   Keypad 7 and Home -> Keyboard Home
#   Keypad 9 and Page Up -> Keyboard Page Up

hidutil property --set '{"UserKeyMapping": [
{"HIDKeyboardModifierMappingSrc":0x70000005A,"HIDKeyboardModifierMappingDst":0x700000051},
{"HIDKeyboardModifierMappingSrc":0x70000005C,"HIDKeyboardModifierMappingDst":0x700000050},
{"HIDKeyboardModifierMappingSrc":0x70000005E,"HIDKeyboardModifierMappingDst":0x70000004F},
{"HIDKeyboardModifierMappingSrc":0x700000060,"HIDKeyboardModifierMappingDst":0x700000052},

{"HIDKeyboardModifierMappingSrc":0x700000059,"HIDKeyboardModifierMappingDst":0x70000004D},
{"HIDKeyboardModifierMappingSrc":0x70000005B,"HIDKeyboardModifierMappingDst":0x70000004E},
{"HIDKeyboardModifierMappingSrc":0x70000005F,"HIDKeyboardModifierMappingDst":0x70000004A},
{"HIDKeyboardModifierMappingSrc":0x700000061,"HIDKeyboardModifierMappingDst":0x70000004B}
]}'
1
  • Nice! Now how to make this toggle back and forth to number keys using a key on the keyboard (from what I've read elsewhere it sounded like the 'clear' key was supposed to do this)?
    – pbouf77
    Commented Feb 6, 2021 at 1:44
3

I had a similar issue and made my complex_modifications for Karabiner Elements available in a pull request here: https://github.com/pqrs-org/KE-complex_modifications/pull/509

1
  • Can confirm it works on macOS Big Sur 11.2.2, with the separate number pad of a Microsoft Sculpt Keyboard For Business (5KV-00001). Can enable in Karabiner-Elements right away using the "Import" button of the first search result in the official repository of rules: Keypad as Arrows (windows style) ke-complex-modifications.pqrs.org/…
    – Arbo
    Commented Mar 5, 2021 at 17:26
2

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!

2

After a better look, I found it in Karabiner: "For PC users" - "Use KeyPad as Arrow" - "Enable KeyPad as Arrow".

I'll leave the question here, it might be useful for someone else.

Update: Karabiner-Elements, which is the only Karabiner for Sierra+, is a new product. In Karabiner-Elements, I just added a mapping from every numpad key to its function, for external keyboard.

2
  • Where can I find this option? I'm unable to find "For PC users" in the 12.1.0 version. Commented Dec 27, 2018 at 19:33
  • Karabiner-Elements is a new product. There, I had to remap all the numpad keys to their functions. Let me check if there is a ready "Complex modification" rule in their repository. Commented Dec 27, 2018 at 23:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .