Skip to content

Fix Kitty base-layout key reporting - #741

Open
Frozen wants to merge 1 commit into
gnachman:masterfrom
Frozen:fix/kitty-base-layout-key
Open

Fix Kitty base-layout key reporting#741
Frozen wants to merge 1 commit into
gnachman:masterfrom
Frozen:fix/kitty-base-layout-key

Conversation

@Frozen

@Frozen Frozen commented Aug 30, 2026

Copy link
Copy Markdown

The Kitty keyboard protocol defines the base-layout alternate as the key at the same physical position in the standard PC-101 layout. iTerm2 currently computes it by stripping modifiers and translating the key through the active layout. On a Russian layout, the physical C key therefore produces Cyrillic с for both the primary and base values, and the encoder omits the base alternate entirely:

  • before: CSI 1089;5u
  • after: CSI 1089::99;5u

This derives the base-layout value from the macOS virtual key code using the fixed ANSI/PC-101 positions instead of the active input source. Functional and keypad keys keep their existing handling. ISO/JIS-only keys, which have no PC-101 position, do not report a base alternate.

The mapping covers every ANSI letter, digit, punctuation key, and Space, with a negative test for the ISO Section key.

Specification: https://sw.kovidgoyal.net/kitty/keyboard-protocol/#key-codes

Kitty’s macOS implementation uses the same fixed virtual-key-code approach: https://github.com/kovidgoyal/kitty/blob/master/glfw/cocoa_window.m

Tested with:

tools/run_tests.expect ModernTests/ModernKeyMapperTests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant