Author Topic: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control  (Read 4003 times)

0 Members and 1 Guest are viewing this topic.

Offline intelli78

  • Thread Starter
  • Posts: 1503
  • Location: Seattle
This only applies to people using an Apple Extended Keyboard with a Mac, via an iMate or similar ADB-to-USB adapter. I hope it's useful to at least one other person.

The AEK's caps lock key is a locking ALPS switch, which means if you want to remap it to Command/Control, you have some work to do. Follow these instructions:

1. First, you need to physically exchange the locking switch with a non-locking switch. I swapped with Num Lock; you can also do something like Pause that you'll never use. I believe due to hardware constraints, this swap will render the donor key useless, so pick something you won't ever use. When you've decided, pop off the Caps Lock keycap and the target key's keycap. Take out the ALPS sliders using screwdrivers as prying tools (documented elsewhere) and exchange the assemblies. No soldering required.

2. Now, your Caps Lock will press like a normal key. But on every press, it will send both keydown and keyup codes due to the AEK's hardware. Gotta fix this.

3. Install KeyRemap4MacBook and PCKeyboardHack. Create a new profile for your AEK.

4. In PCKeyboardHack, check "Change Caps Lock" and change it to keycode 110.

5. In KeyRemap, open your private.xml and insert the following code:

More
                                  <item>
    <name>AEK I caps lock to command fix</name>
    <identifier>private.aekcapslock_fix</identifier>
    <block>
      <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::VK_LOCK_COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::ESCAPE, KeyCode::ESCAPE, KeyCode::VK_LOCK_ALL_FORCE_OFF</autogen>
    </block>
  </item>

6. Go to System Prefs --> Keyboards --> Modifier Keys --> ADB adapter --> set caps lock behavior to "no action."

At this point, everything should be working as you want it to.

7. (Optional) In KeyRemap, go to the "Status Message" tab and uncheck status messages so you don't see the lock notification every time you hold caps lock.

8. (Optional) Return to the system key modifiers dialog and set caps lock to another key.

9. Add the following to your private.xml and enable it for any non-AEK keyboard. If you don't include this, you'll have problems using caps lock with other keyboards. (You can get around this if you use clean private.xml code in which you define vendors and devices for every hack; I don't, so this is the sloppy way to do it).

More
                                      <item>
    <name>Non-AEK caps lock fix, need for all non-AEK boards</name>
    <identifier>private.nonaekfix</identifier>
      <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::CAPSLOCK</autogen>
  </item>

Please consider carefully before you decide to comment, for Jesus.

Offline ocodo

  • Posts: 27
  • Location: Singapore
I wanted to just remap my AEK II's Caps Lock to Control (for Emacs / GNU Readline keys).  Instead of swapping out another ALPS key slider, I just pulled out the little white locking lug.  After reassembling the slider, it worked as expected.

Using Seil (which is the new name of PCKeyboardHack) I followed the instructions above, and mapped it to 110, PC MENU (aka PC APPLICATION key.)  I didn't experiment with the setting at all, but I was interested why not just map it directly? (I may try a few things out for future reference.)

For Karibiner (formerly KeyRemap4MacBook) set ~/Library/Application Support/Karabiner/private.xml to...: (preserve any other settings you might have of course!)

Code: [Select]
<?xml version="1.0"?>
<root>
  <item>
    <name>Apple Extended Keyboard II - map Caps Lock → Control (Seil maps Caps Lock to PC Menu Key)</name>
    <identifier>private.aekcapslock_fix</identifier>
    <block>
      <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::VK_LOCK_CONTROL_L</autogen>
    </block>
  </item>
</root>

Everything works as expected.

I thought I'd add a couple of notes on removing the Caps Lock locking mechanism from the ALPS switch, in case it helps someone in future.

  • Pull the Key cap off the switch carefully with a slim screw driver, prise it off at the sides.
  • Using a pair of jewellers screwdrivers, with each one at the front and back faces of the switch, slide them into the small retaining clips, they will release the top of the switch.
  • You should be able to lift off the top of the cap (don't pull it out of the mounting / pcb!). Then you can remove the white locking lug from inside the switch.
  • Replace the slider without the white lug, and put the top back on.

It should just work.

As usual, at your own risk, blah blah blah, I am not responsible for you, or your keyboard.
« Last Edit: Thu, 04 December 2014, 11:23:48 by ocodo »

Offline intelli78

  • Thread Starter
  • Posts: 1503
  • Location: Seattle
Thanks for documenting your work. I'm sure it will help someone!
Please consider carefully before you decide to comment, for Jesus.

Offline ocodo

  • Posts: 27
  • Location: Singapore
Cheers, it was easier than expected.  The AEK II has been sitting on my shelf since July.  I'd assumed it would be far more difficult to do the mod,  I was pleasantly surprised!


Later on (this morning), I found this useful image ...



Some helpful details on the git repo...: https://github.com/cfenollosa/aekii/

Offline ClickityClock

  • Posts: 6
  • Location: California
This only applies to people using an Apple Extended Keyboard with a Mac, via an iMate or similar ADB-to-USB adapter. I hope it's useful to at least one other person.

The AEK's caps lock key is a locking ALPS switch, which means if you want to remap it to Command/Control, you have some work to do. Follow these instructions:

1. First, you need to physically exchange the locking switch with a non-locking switch. I swapped with Num Lock; you can also do something like Pause that you'll never use. I believe due to hardware constraints, this swap will render the donor key useless, so pick something you won't ever use. When you've decided, pop off the Caps Lock keycap and the target key's keycap. Take out the ALPS sliders using screwdrivers as prying tools (documented elsewhere) and exchange the assemblies. No soldering required.

2. Now, your Caps Lock will press like a normal key. But on every press, it will send both keydown and keyup codes due to the AEK's hardware. Gotta fix this.

3. Install KeyRemap4MacBook and PCKeyboardHack. Create a new profile for your AEK.

4. In PCKeyboardHack, check "Change Caps Lock" and change it to keycode 110.

5. In KeyRemap, open your private.xml and insert the following code:

More
                                  <item>
    <name>AEK I caps lock to command fix</name>
    <identifier>private.aekcapslock_fix</identifier>
    <block>
      <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::VK_LOCK_COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::ESCAPE, KeyCode::ESCAPE, KeyCode::VK_LOCK_ALL_FORCE_OFF</autogen>
    </block>
  </item>

6. Go to System Prefs --> Keyboards --> Modifier Keys --> ADB adapter --> set caps lock behavior to "no action."

At this point, everything should be working as you want it to.

7. (Optional) In KeyRemap, go to the "Status Message" tab and uncheck status messages so you don't see the lock notification every time you hold caps lock.

8. (Optional) Return to the system key modifiers dialog and set caps lock to another key.

9. Add the following to your private.xml and enable it for any non-AEK keyboard. If you don't include this, you'll have problems using caps lock with other keyboards. (You can get around this if you use clean private.xml code in which you define vendors and devices for every hack; I don't, so this is the sloppy way to do it).

More
                                      <item>
    <name>Non-AEK caps lock fix, need for all non-AEK boards</name>
    <identifier>private.nonaekfix</identifier>
      <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::CAPSLOCK</autogen>
  </item>

Thank god I found this! I thought my AEK was damaged. It and my AEK II.....they caps lock doesn't work on either. Glad I have several extra switches laying around that I can swap them out with. Seems like an easy fix. Thanks

Offline lubert

  • Posts: 1
Sorry to post in an old topic, but have any of you by chance gotten this to work with Karabiner-Elements with mojave? The interface for keymapping seems to have changed, and I can't find the equivalent to remap the caps lock. Thank you!

Offline Lanrefni

  • Posts: 117
Sorry to post in an old topic, but have any of you by chance gotten this to work with Karabiner-Elements with mojave? The interface for keymapping seems to have changed, and I can't find the equivalent to remap the caps lock. Thank you!

QMK ADB to USB is pretty easy and cheap to build,then just use QMK Configurator to build your firmware,it works really well.