Extra Keys
Understanding Keys on Termux and Shortcuts¶
You might have noticed that the keyboard at the bottom of the screen has some pretty useful keys by default! These are ESC
, TAB
, CTRL
, ALT
, -
, DOWN
and UP
.
But you can always edit these if you want to!
Use of keys like ALT
, CTRL
, ESC
is necessary for working with a CLI terminal. Termux touch keyboards do not include one. For that purpose Termux uses the Volume down button to emulate the CTRL
key. For example, pressing VOLUME DOWN+L
on a touch keyboard sends the same input as pressing Ctrl+L on a hardware keyboard.
The result of using CTRL
in combination with a key depends on which program is used, but for many command line tools the following shortcuts works:
CTRL+A
→ Move cursor to the beginning of lineCTRL+C
→ Abort (send SIGINT to) current processCTRL+D
→ Logout of a terminal sessionCTRL+E
→ Move cursor to the end of lineCTRL+K
→ Delete from cursor to the end of lineCTRL+L
→ Clear the terminalCTRL+Z
→ Suspend (send SIGTSTP to) current processCTRL+ALT+C
→ Open new session (only work in Hacker's Keyboard)
The Volume up key also serves as a special key to produce certain input:
VOLUME UP+E
→ Escape keyVOLUME UP+T
→ Tab keyVOLUME UP+1
→ F1 (and Volume Up+2 → F2, etc)VOLUME UP+0
→ F10VOLUME UP+B
→ Alt+B, back a word when using readlineVOLUME UP+F
→ Alt+F, forward a word when using readlineVOLUME UP+X
→ Alt+XVOLUME UP+W
→ Up arrow keyVOLUME UP+A
→ Left arrow keyVOLUME UP+S
→ Down arrow keyVOLUME UP+D
→ Right arrow keyVOLUME UP+L
→ | (the pipe character)VOLUME UP+H
→ ~ (the tilde character)VOLUME UP+U
→ _ (underscore)VOLUME UP+P
→ Page UpVOLUME UP+N
→ Page DownVOLUME UP+.
→ Ctrl+ (SIGQUIT)VOLUME UP+V
→ Show the volume controlVOLUME UP+Q
→ Show extra keys viewVOLUME UP+K
→ Another variant to toggle extra keys view
Adding extra keys¶
Termux also has an extra keys view which allows you to extend your current keyboard. To enable the extra keys view you have to long tap on the keyboard button in the left drawer menu. (Swipe from left → right to open the drawer)
Abstract
You can also press VOLUME UP+Q
or VOLUME UP+K
.
Note
From Termux v0.66, Extra keys are enabled by default. You can remove these by long pressing on the keyboard again
Open the termux.properties
file:
Example
$ nano ~/.termux/termux.properties
Directory .../home/.termux doesn't exist
If you get the above error, then that means that the .termux
directory doesn't exist. Try making it, before doing this, with
mkdir $HOME/.termux/
Now we will start by adding two rows of some really useful keys(default keys until v0.66)
extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'],['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']]
extra-keys
is the key and the value is a list(array) of lists with the extra keys!
The extra-keys definition itself can also be spread over multiple lines, if desired, by "backslash-escaping" the line feed at the end of each line, thus:
extra-keys = [ \
['ESC','/','-','HOME','UP','END','PGUP'], \
['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN'] \
]
Success
It should look something like this:
Each key "entry" can be either a string (such as '|'
, '/'
or '='
) or one of the values listed below. These values are defined in ExtraKeysView.java, and the list of values (not including possible synonyms) is:
- CTRL ("special key")
- ALT ("special key")
- FN ("special key")
- ESC ("special key")
- TAB
- HOME
- END
- PGUP
- PGDN
- INS
- DEL
- BKSP
- UP
- LEFT
- RIGHT
- DOWN
- ENTER
- BACKSLASH
- QUOTE
- APOSTROPHE
Bug
Each of the four "special keys" listed above should only be listed at most ONCE in the extra-keys definition i.e. do NOT have more than one CTRL key. Having more than one instance of any "special key" will result in a bug whereby those keys do not function correctly.
Saving the properties¶
Now you must save the file. To do so, you need to:
- Hit
CTRL+X
(orVOLUME DOWN+X
which is the same thing.) - Press
y
on the keyboard to save changes - Press
ENTER
to save the filename!
Enabling the changes¶
Termux won't directly load the save changes. You can use any of the following ways to enable these changes:
- Restart the application! (Easiest way)
- Run
source ~/.termux/termux.properties
to load the file (The linux way) - Run
termux-reload-settings
(the offical way)
All 3 of these work the same. If one doesn't for you, then use the other
For the linux nerds
You don't need to follow any of the above steps. We didn't put this in the beginning because spoon-feeding is against our policies. Sorry, lol
Use this one command if you want it to happen:
Example
mkdir $HOME/.termux/ ;echo "extra-keys = [['ESC','/','-','HOME','UP','END','PGUP'],['TAB','CTRL','ALT','LEFT','DOWN','RIGHT','PGDN']]" >> $HOME/.termux/termux.properties; termux-reload-properties;
Success
The keyboard on the bottom should look something like this now! Well Done!
Tightly Packed Keys
If after doing all the above steps, the keys look too tightly packed to you then that's probably a bug.
Just close the application with CTRL+D
or Exit from the notification shade and restart it. This should hopefully fix it