
Table of Contents
Konsole uses *.keytab files to translate key combinations into control characters and escape sequences that are sent to the shell or to interactive programs (typically programs that use the Alternate Screen buffer, e.g. vim, less, screen) running in the shell.
Users can customize the key bindings settings in Konsole using the Key Bindings Editor. A key combination can be configured to send a specific control or escape sequence to the terminal.
You can open the Key Bindings Editor from the menu entry → , and going to the Keyboard tab. Listed there are the Key Bindings schemas that come by default with Konsole.
Key combinations follow the pattern:
Key (+|-) Modes
for example:
Up+Shift+AppScreen Down+Shift-AppScreen Space+Ctrl
Key names are defined in the qnamespace.h header file, with the “Qt::Key_” prefix removed, for a list of key names check the Qt::Key enumeration in the Qt™ documentation.
A “+” preceding a Mode name means that mode is set; for a modifier key, that means it's pressed, whereas for all other modes it means that particular mode is in effect (i.e. active). For example “+Ctrl” means the key combination will work only if the Ctrl key is pressed.
A “-” preceding a Mode name means that mode is reset; basically this is the opposite of putting “+” before a Mode name, so for a modifier key that means the key isn't pressed, whereas for all other modes it means that particular mode is inactive. For example “-Ctrl” means the key combination will work only if the Ctrl key is not pressed.
Note
If a Mode name isn't present in a key combination, its state is ignored.
The supported Key Bindings modes are listed below:
- Alt, Ctrl, Shift
One or more of these Modes can be used in a key combination, if any of them is set, the key combination uses that modifier key, respectively; and vice versa if it's reset
- AnyModifier
If this mode is set, the key combination uses any modifier key (any of the previous three modifier keys); and vice versa if it's reset
- Ansi
If this mode is set, Konsole will send ANSI escape and control sequences
If this mode is reset Konsole will send VT52 escape and control sequences
- AppScreen
If this mode is set, the key combination will only affect interactive programs that use the Alternate Screen buffer
If this mode is reset the key combination will only affect the terminal when it's using the Normal Screen buffer
Note
Konsole makes use of two screen buffers:
The Normal Screen buffer (default): allows you to scroll back to view previous lines of output, this is the default buffer you usually use to execute commands... etc.
The Alternate Screen buffer: the terminal switches to this buffer when you run an interactive program (e.g. less, vim, screen, tmux... etc.)
- KeyPad
If this mode is set, the key combination uses a key on the Keypad (Number Pad). This mode is useful to distinguish between keys on the keyboard and keys on the Keypad. For example when Num Lock is on you can configure two separate key combinations, one using the key labelled “1” on the keyboard (usually under the F1 key) and the other using the key labelled “1” on the Keypad. The same concept applies when Num Lock is off for the End, Home, Cursor Keys ...etc on the Keypad
- AppCursorKeys
This mode implements the VT100 Cursor Keys Mode (DECCKM). It controls the escape sequences each Cursor Key (Up, Down, Right, Left) sends, depending on whether this mode is set or reset
By default Konsole follows the XTerm behavior of treating the Home and End keys as cursor keys with respect to DECCKM
- AppKeyPad
If this mode is set, the key combination will only work when the Keypad is in Application Mode (DECKPAM)
If this mode is reset, the key combination will only work when the Keypad is in Numeric Mode (DECKPNM)
- NewLine
If this mode is set, the Return (Enter) key on the keyboard will send both Carriage Return "\r" and New Line "\n" control characters
If this mode is reset, the Return key will send only a Carriage Return "\r"
The same applies to the Enter key on the Keypad
This mode emulates the LNM - Line Feed/New Line Mode
Note that each combination of Key and Modes (set/reset) must be unique. For example, consider the following two rules:
A+Shift : “A”
a : “a”
Konsole will not accept the small letter “a” rule, you have to add a “-Shift” to that rule to make it work.
In the Output field you can add the escape sequences or control characters that you want Konsole to send to the terminal when the associated key combination is pressed.
You can also use any of the following keywords, each of which has a special meaning in Konsole:
scrollUpLine : scroll up one line in the shell history scrollback buffer
scrollUpPage : scroll up one page in the shell history scrollback buffer
scrollDownLine : scroll down one line in the shell history scrollback buffer
scrollDownPage : scroll down one page in the shell history scrollback buffer
scrollUpToTop : scroll up to the begining of the shell history scrollback buffer
scrollDownToBottom : scroll down to the end of the shell history scrollback buffer
You can also use strings with C-string syntax; you may use the following escapes sequences:
\E : Escape
\\ : Backslash
\" : Double quote
\t : Tab
\r : Carriage Return
\n : New line
\b : Backspace
\xHH : where HH are two hex digits
Tip
This can be used to send ASCII control characters, e.g. “\x00” which is the NUL character
There are other system resources that can affect terminal Key Bindings:
Consult the terminfo or termcap database for the expected escape sequences and control characters that each key combination is supposed to send.
It is likely that your system has other keyboard databases which have to be in sync too, (e.g. /etc/inputrc and readline for the BASH shell) as they affect the operations (interactions) bound to key combinations.
For more information on escape sequences and control characters, check the following documentation:
The comprehensive and indispensable XTerm Control Sequences documentation