I have a Samsung Galaxy S Relay running Android 4.1.2; it's an unusual phone because it slides open to reveal a built-in physical keyboard.

The keyboard has no Esc key. It'd be nice to have one, so that I could use it inside Terminal IDE and various terminal emulators and other apps. The Esc key is useful in the Vim text editor, as well as other software which has been ported from Linux to Android.

I'd like to remap one of the keyboard keys which I don't use (such as the voice-search key or the compose-new-email key) to send Escape.

My phone is running stock unrooted Android. But if you would like me to root it or to install CyanogenMod, that is fine.

I'm willing to modify any of the configuration files stored on the device. But I don't want to spend any money to buy a third-party app.

The Hacker's Keyboard is good. But, since I already have a physical keyboard, I want to use the physical keyboard. Cellphone screens aren't big screens; I don't want to spend valuable screen real estate on a virtual keyboard.

How can I remap a spare keyboard key to send Esc?

  • 1
    You might want to consider using this virtual Hackers Keyboard app based on this project. It provides working Tab/Ctrl/Esc keys, and the arrow keys.
    – Lucky
    Jul 6, 2015 at 8:13

3 Answers 3


Here are some threads from the xda-developers Galaxy S Relay 4G general forum which may be helpful.


While this isn't for your device, it might work out for ya. Take a look at this post on XDA. It talks about remapping keys on the Droid 4, which also has a physical keyboard.

"Remapping Physical Buttons/Adding Alternate Keys"

  • Could you add the relevant info from the link here? Since you're already aware of the reason for my requirement, please consider fulfilling it. :)
    – Firelord
    Jul 6, 2015 at 20:12

Since Android 4.1 you can do it without root by installing an app that provides additional keyboard layouts (Key Character Map files).

The example of such app could be found here (I'm the developer).

If you don't familiar with Android development and/or don't want to build such app, there is web-app to do it (I'm the developer). It's free and open-sourced.

There is an example of KCM-file that describes Esc to CapsLock mapping:


map key 58 ESCAPE

58 is a KEY_CODE for CapsLock key. To make other key act like Esc key you should find the key-code that is produced by that key. There are several Android apps to do it. For example Gamepad tester (note that it uses 'scan code' to refer to a key code). So the KCM-file will look like:




ExKeyMo web app is not available on Heroku anymore. You'll have to run it locally. See the project's page on GitHub.


You must log in to answer this question.

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