geekhack

geekhack Community => Keyboards => Topic started by: intelli78 on Sat, 05 April 2014, 18:09:20

Title: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control
Post by: intelli78 on Sat, 05 April 2014, 18:09:20
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>

Title: Re: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control
Post by: ocodo on Thu, 04 December 2014, 11:07:23
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.


It should just work.

As usual, at your own risk, blah blah blah, I am not responsible for you, or your keyboard.
Title: Re: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control
Post by: intelli78 on Thu, 04 December 2014, 15:44:19
Thanks for documenting your work. I'm sure it will help someone!
Title: Re: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control
Post by: ocodo on Thu, 04 December 2014, 18:43:42
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 ...

(https://github.com/cfenollosa/aekii/raw/master/img/removekeys.JPG)

Some helpful details on the git repo...: https://github.com/cfenollosa/aekii/
Title: Re: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control
Post by: ClickityClock on Sun, 27 May 2018, 21:02:02
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
Title: Re: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control
Post by: lubert on Sun, 14 July 2019, 12:58:35
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!
Title: Re: How to: Make Caps Lock on an Apple Extended Keyboard work as Command/Control
Post by: Lanrefni on Sun, 14 July 2019, 14:12:32
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 (https://github.com/qmk/qmk_firmware/tree/master/keyboards/converter/adb_usb) is pretty easy and cheap to build,then just use QMK Configurator (https://config.qmk.fm/#/converter/adb_usb/LAYOUT_ext_ansi) to build your firmware,it works really well.