Take Command supports the application-negotiated Kitty keyboard protocol in ConPTY and serial terminal tabs. The protocol lets terminal applications distinguish modified keys, function and keypad keys, key repeats, key releases, alternate keyboard layouts, and associated text.
This is an application feature, not a Take Command keyboard preference. A tab uses normal terminal keyboard encoding until the program running in that tab enables Kitty keyboard enhancements.
•Existing terminal applications retain their normal keyboard behavior.
•Each terminal tab negotiates its own state. Enabling the protocol in one tab does not affect other tabs.
•The primary and alternate screen buffers maintain separate protocol state.
•A terminal reset clears the negotiated state and restores legacy keyboard behavior.
•Applications should disable or pop an enhancement mode when they exit it.
•Take Command preserves the protocol's compatibility behavior for unmodified Enter, Tab, Backspace, and Escape where applicable. An application that requests all-key reporting receives the fully unambiguous Kitty form instead.
Applications send Kitty keyboard control sequences to the terminal. In the sequences below, CSI means ESC [ and flags is the sum of the requested feature values.
Flag |
Value |
Requested information |
|---|---|---|
Disambiguate escape codes |
1 |
Unambiguous encoding for modified keys and escape sequences. |
Report event types |
2 |
Press, repeat, and release events. |
Report alternate keys |
4 |
Shifted and base-layout key codes. |
Report all keys |
8 |
Reports all key presses, including keys that normally produce text. |
Report associated text |
16 |
Text code points associated with all-key reports. |
Send:
CSI = flags ; mode u
mode has the following values:
Mode |
Meaning |
1 |
Replace the active flags with flags. |
2 |
Add flags to the active flags. |
3 |
Remove flags from the active flags. |
For example, CSI = 31 u enables all five supported enhancements. CSI = 0 u returns the active screen to legacy keyboard mode.
Application sends |
Take Command response or action |
|---|---|
CSI ? u |
Replies with CSI ? flags u for the active screen. |
CSI > flags u |
Pushes the current state and activates flags. |
CSI < count u |
Pops count saved states; omitting count pops one. |
The state stack is limited to 16 entries per screen buffer. A pop that empties the stack restores legacy mode.
When enabled, Take Command emits Kitty key events in this form:
CSI unicode-key-code:alternate-key-codes;modifiers:event-type;text-as-codepoints u
Only the key code is required. The other fields appear only when they are needed or requested:
•Non-Unicode functional keys, including arrows, navigation, function, keypad, media, and modifier keys, use the protocol's private-use key codes.
•The modifier field is one plus the modifier bit mask described by the Kitty specification.
•Event type is 1 for press, 2 for repeat, and 3 for release.
•Alternate keys and text code points are sent only when the respective flags are active.
See the upstream specification for the complete functional-key table and cross-platform modifier definitions.
For a small protocol probe, an application can:
1.Send CSI = 31 u.
2.Send CSI ? u and expect CSI ? 31 u.
3.Send CSI = 0 u.
Use a terminal-aware diagnostic program for this test. Typing these literal strings at a shell does not send control sequences unless the shell or program converts them to escape bytes.