Friday, November 9, 2012

EKH Tutorial 4 - Using CapsLock as AltGr

This is the 4th tutorial for External Keyboard Helper and it is based on a real support question I got yesterday.

Let's say you have a compact bluetooth keyboard that doesn't have an Alt or AltGr button. However you want to use the US-International layout which has a lot of extra characters that can only be reached with AltGr and AltGr+Shift.

In this example I will show you how to sacrifice the (in my opinion rather useless) CapsLock key for a more useful AltGr key.

First I select the layout I intend to use. In this example the English (US-International) layout.

After that I enter the Advanced settings and

I choose to Customize keyboard mappings.

I choose to the create the Custom 1 layout using my selected layout as a base and

then Add a new key mapping.

Pressing the CapsLock key makes it read it's scancode which is 58 and I check the Keycode checkbox and choose Right Alt modifier as the keycode I want to map it to.

To make sure External Keyboard Helper ignores whatever the Android system things that the CapsLock state is I must also check Override special keys and make sure Always remap keys is checked.

That's it. CapsLock now serves as AltGr and I can access all the special characters that my selected layout has mapped for AltGr and AltGr+Shift even though my keyboard does not have a physical Alt or AltGr key.


  1. I have a keyboard which contains an AltGr key which does not generate a scancode until a second key is pressed. Once the second key is pressed, the key combination produces 5 bytes. I made a simple app to display the 5 bytes produced (EKH and Chris Boyle's app show the last byte). As an example: AltGr + Z key generate the following base10 values:

    ScanCode 100 82 80 81 82
    KeyCode 58 144 146 147 144

    The keyboard isn't doing anything completely proprietary because it functions properly with both windows and Linux. The keycodes and special symbols (mostly Latin/Greek) are produced correctly.

    I don't believe this to be a problem with EKH but with android. Any comments on this subject would be helpful.

  2. I had a similar, but worse, problem on an iPad. I think I was trying to send Shift-Tab. It would wait to send all the keypresses at once and then sent them in the wrong order!

    I'm having a similar problem EKH and Emacs. Shift-tab does not work in org-mode.

  3. How would I map to get the second functions of my hardware keyboard to work? Would purchasing the full version solve the problem? (DEMO VERSION!)

  4. This comment has been removed by the author.

  5. I'm trying to map capslock to control (I'm using Termux, and want control keys, and my bluetooth keyboard has a little ctrl key in an awkward place). I've followed the tutorial, and can get scan code 58 in the right place to tell the app which key I want to remap, but I can't seem to get it to recognize ctrl as the map-to.
    Greg Wilson (

  6. What key combo do u use to launch the remapped app