Skip to content

Add support for the Kitty Keyboard Protocol #4809

Description

@tig

The Kitty keyboard protocol (often called "kitty protocol" for input) is a modern, opt-in extension to how terminals report keyboard events to applications. It was originally created by the developer of the kitty terminal emulator to fix long-standing problems in traditional terminal keyboard handling.

Traditional terminals (using legacy escape sequences) have many ambiguities:

  • Ctrl+I is identical to Tab
  • Ctrl+M is identical to Enter
  • Ctrl+[ is identical to Esc
  • Many modifier combinations (especially with Alt, Ctrl+Alt, Super/Windows key, etc.) get lost or mangled
  • No reliable way to distinguish press / repeat / release events
  • No relialbe way to detect key-up events.
  • No clean support for many modern modifiers (Hyper, Meta, Caps/Num lock state, etc.)
  • Layout / physical key vs produced text is often confused

The Kitty protocol solves this by using structured CSI u sequences (Control Sequence Introducer + "u" terminator) that unambiguously encode:

  • The physical key code (Unicode code point or special key number)
  • All active modifiers (Shift, Ctrl, Alt, Super, Hyper, Meta, Caps Lock, Num Lock — reported as a bitmask)
  • Event type (press, repeat, release)
  • Optional associated text (when the key produces printable characters)

It remains backward compatible: if an app doesn't request the new mode, the terminal falls back to legacy behavior for keys like Enter, Tab, Backspace.

Applications explicitly enable levels of the protocol (via escape sequences like CSI > flags ; mode u), with common useful modes including:

  • Disambiguate escape codes
  • Report events as escape codes (instead of plain text for normal keys)
  • Report associated text when helpful
  • Report alternate/primary keys, release events, etc.
  • Report key-up events in addition to key-down

Many terminals now support it (kitty, WezTerm, foot, Alacritty, iTerm2, Rio, Ghostty — and as of very recently, Windows Terminal in Preview builds, specifically version 1.25 and later).

Windows Terminal support (as of March 2026)

Windows Terminal added built-in support for the Kitty keyboard protocol in Preview 1.25 (released around early 2026 or late 2025).
Once you're on a recent enough build:

  • The protocol is available when running inside Windows Terminal.
  • Applications can query/report/enable it just like in other supporting terminals.
  • No special setting is usually needed — apps opt in themselves.

Since Windows Terminal now speaks the protocol, a could make many more key bindings reliable and unambiguous — especially for complex shortcuts that previously collided or were impossible on Windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions