Skip to content

Support Kitty keyboard REPORT_ALTERNATE_KEYS (4) and REPORT_ASSOCIATED_TEXT (8) #30

Open

Description

@tony

Summary

src/libvt/input.py (#2) defines all five KittyKeyboardFlags bits (DISAMBIGUATE, REPORT_EVENT_TYPES, REPORT_ALTERNATE_KEYS, REPORT_ALL_KEYS, REPORT_ASSOCIATED_TEXT) and implements CSI u encoding for DISAMBIGUATE (1), REPORT_EVENT_TYPES (2), and REPORT_ALL_KEYS (8), while subparameter generation for REPORT_ALTERNATE_KEYS (4) and REPORT_ASSOCIATED_TEXT (8 / 16 wire bit) is deferred to 0.2.0.

Motivation

First double-check flag bit values against the Kitty Keyboard Protocol specification (0b1 disambiguate, 0b10 event types, 0b100 alternate keys, 0b1000 all keys as escape codes, 0b10000 associated text) and emit colon-separated unicode-key-code:shifted-key:base-layout-key (4) plus semicolon-separated ;text-as-codepoints (16) when those progressive-enhancement flags are negotiated by editors such as helix, kakoune, or kitty +kitten.

Proposal

Invariants

The invariants below are load-bearing; everything under Intent is open.

  • KittyKeyboardFlags integer bit values match the Kitty wire protocol (1, 2, 4, 8, 16).
  • When REPORT_ALTERNATE_KEYS (4) is active, shifted/alternate and optional base-layout codepoints serialize in the first parameter group (key:shifted:base), and when REPORT_ASSOCIATED_TEXT (16) is active on PRESS/REPEAT, associated text codepoints serialize in the third semicolon group (CSI key ; mods:event ; cp1:cp2 u), omitting control characters (< 32 and 127).

Intent (non-binding)

  • Target 0.2.0: add optional shifted_key: str = "" and base_key: str = "" fields on KeyEvent (with default US-ASCII shift mapping for convenience in KeyEvent.parse()) and serialize REPORT_ALTERNATE_KEYS and REPORT_ASSOCIATED_TEXT in _encode_key().

Not doing

  • Querying host OS XKB/macOS/Win32 keyboard layouts inside sans-I/O libvt.

References

Activity

  1. added
    enhancement
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions