2

The wireless Apple keyboard and the laptops don't have a numeric keypad. While KeyRemap4Macbook provides a virtual numpad, it requires Fn to be pressed while using it.

Is it possible to use the Caps Lock key (which I never use) for laptop-style Num Lock equivalent functionality, i.e. to get a number pad using regular letter keys while it's active?

Inspired by NumLock app, which will require additional software to run, but won't require replacing the Caps Lock key functionality.

2 Answers 2

3

You could also change caps lock to F19 with PCKeyboardHack and then add this to private.xml in KeyRemap4MacBook:

<item>
  <name>numpad</name>
  <identifier>numpad</identifier>
  <autogen>__KeyToKey__ KeyCode::F19, KeyCode::VK_LOCK_EXTRA1</autogen>
  <autogen>__KeyToKey__ KeyCode::M, ModifierFlag::EXTRA1, KeyCode::KEYPAD_0</autogen>
  <autogen>__KeyToKey__ KeyCode::COMMA, ModifierFlag::EXTRA1, KeyCode::KEYPAD_COMMA</autogen>
  <autogen>__KeyToKey__ KeyCode::DOT, ModifierFlag::EXTRA1, KeyCode::KEYPAD_DOT</autogen>
  <autogen>__KeyToKey__ KeyCode::SLASH, ModifierFlag::EXTRA1, KeyCode::KEYPAD_PLUS</autogen>
  <autogen>__KeyToKey__ KeyCode::J, ModifierFlag::EXTRA1, KeyCode::KEYPAD_1</autogen>
  <autogen>__KeyToKey__ KeyCode::K, ModifierFlag::EXTRA1, KeyCode::KEYPAD_2</autogen>
  <autogen>__KeyToKey__ KeyCode::L, ModifierFlag::EXTRA1, KeyCode::KEYPAD_3</autogen>
  <autogen>__KeyToKey__ KeyCode::SEMICOLON, ModifierFlag::EXTRA1, KeyCode::KEYPAD_MINUS</autogen>
  <autogen>__KeyToKey__ KeyCode::U, ModifierFlag::EXTRA1, KeyCode::KEYPAD_4</autogen>
  <autogen>__KeyToKey__ KeyCode::I, ModifierFlag::EXTRA1, KeyCode::KEYPAD_5</autogen>
  <autogen>__KeyToKey__ KeyCode::O, ModifierFlag::EXTRA1, KeyCode::KEYPAD_6</autogen>
  <autogen>__KeyToKey__ KeyCode::P, ModifierFlag::EXTRA1, KeyCode::KEYPAD_MULTIPLY</autogen>
  <autogen>__KeyToKey__ KeyCode::KEY_7, ModifierFlag::EXTRA1, KeyCode::KEYPAD_7</autogen>
  <autogen>__KeyToKey__ KeyCode::KEY_8, ModifierFlag::EXTRA1, KeyCode::KEYPAD_8</autogen>
  <autogen>__KeyToKey__ KeyCode::KEY_9, ModifierFlag::EXTRA1, KeyCode::KEYPAD_9</autogen>
  <autogen>__KeyToKey__ KeyCode::KEY_0, ModifierFlag::EXTRA1, KeyCode::KEYPAD_SLASH</autogen>
</item>

See the source for the key code values and predefined settings.

2

Download and run the Ukelele keyboard layout editor. Select File » New From Current Input Source to load your current keyboard layout (e.g. British).

Now, press Caps Lock. You'll see that the Caps Lock key on the virtual keyboard in Ukele will be highlighted, and all letter keys appear in upper case.

Double-click each of the letter keys you want to change. A character assignment dialog pops up. Type the number you want to assign to that key and confirm. Optionally, you can also delete all letters from the rest of the keys (i.e. remove output from the assignment dialog and confirm).

Now, assign a new name (e.g. British with Caps Lock Numpad) and ID (e.g. 10000 + original ID) using Keyboard » Set Keyboard Name and Keyboard » Set Keyboard ID.

Screenshot

Save the keyboard layout as a file in ~/Library/Keyboard Layouts and select it in System Preferences » Language & Text » Input Sources.

1
  • 1
    Keyboard layouts in the user library can't be selected in password dialogs, and the popovers shown when holding keys only work with the bundle format. See the section about custom keyboard layouts in lri.me/osx.html.
    – Lri
    Apr 30, 2013 at 13:23

You must log in to answer this question.

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