Remapping Keys with JSON

TinyTERM Enterprise for Android version 1.5.0 introduced another method of remapping keys, the keymap.json file. This file allows reassigning keys globally, rather than through a keyboard layout file. keymap.json does not replace keyboard layout files, but instead supplements them by redefining individual keys. Even the Android system buttons can be redefined.

All information stored in keymap.json is global. The defined key mappings apply to all sessions.




KEYMAP.JSON File Format

keymap.json follows a standard JSON file format. It opens and closes with curly braces {}. Each line defines a single key in the format:

"<key>" : "definition"

The angle brackets are required around the key name, unless remapping a single alphanumeric character. The key definition can be a quoted string, or a procedure call enclosed in curly braces.

Each line but the last must also end in a comma. Here's a sample file that demonstrates these.

{
"<ANDMENU>" : { "proc" : "CEN_PROC_SELECT_KEYBOARD" , "args" : "Scanner" },
"<ANDBACK>" : "<PF3>",
"<PF19>"    : "NEXT"
}

The first line remaps the Android menu button, which calls the CEN_PROC_SELECT_KEYBOARD process, changing the keyboard layout to the "Scanner" layout. The second line changes the Android back button to send the PF3 function key. And the third line remaps the PF19 function key to send the word "NEXT" as a typed string.




Available Keys

Four Android buttons are available to be remapped. Note that not all buttons are available on all devices:

  • ANDBACK: back, a curving left arrow
  • ANDMENU: menu, a stack of horizontal lines
  • ANDOVERVIEW: overview, a square or building
  • ANDSEARCH: search, a magnifying glass

Enclose these in quotation marks and angle brackets as above to define them; e.g., "<ANDSEARCH>".

All regular keyboard keys can be remapped as well. For lists of those, see the individual keyboard references:

As with the Android buttons, special key names should be enclosed in quotation marks and angle brackets; e.g., "<SF3>".




Importing KEYMAP.JSON

Once the keymap.json file is created, it needs to be imported into TinyTERM. To do that, export the current TinyTERM settings. Uncompress the resulting .ttconfig file as described. Add keymap.json into the resulting files. Compress and rename the configuration. The keymap.json file will be included when the new .ttconfig file is imported.




Sample KEYMAP.JSON File

Download a sample keymap.json file here.


Android User Guide Table of Contents