Skip to content

Support non-Latin keyboard layouts in kitty keys and bindings - #1958

Open
okhsunrog wants to merge 1 commit into
raphamorim:mainfrom
okhsunrog:kitty-base-layout-key
Open

okhsunrog wants to merge 1 commit into
raphamorim:mainfrom
okhsunrog:kitty-base-layout-key

Conversation

@okhsunrog

Copy link
Copy Markdown

With a non-Latin layout active, keys pressed with Ctrl/Alt/Super are reported and matched by their layout character, so shortcuts break: ctrl+с on a Cyrillic layout reaches apps as CSI 1089;5u, which apps that enable REPORT_ALTERNATE_KEYS can't match as ctrl+c, and ctrl+shift+м never triggers rio's own ctrl+shift+v paste binding. The kitty protocol covers this with the base layout key, the key at the same position in the standard PC-101 layout. The existing comment said winit doesn't expose it, but it can be derived from KeyEvent::physical_key, which is position-based.

  • Report the base layout key when REPORT_ALTERNATE_KEYS is on and it differs from the key code: ctrl+с is sent as CSI 1089::99;5u, shift+с as 1089:1057:99. Sequences on a US layout are unchanged.
  • When no key binding matches a textual key pressed with Ctrl, Alt or Super, retry with the same PC-101 key, so ctrl+shift+c/v/t etc. work on non-Latin layouts. Bindings on the layout character still take precedence, and plain or shifted typing never falls back.
  • Unit tests for the PC-101 mapping and the alternate-keys field format

With a Cyrillic layout active, ctrl+с was reported as ctrl+U+0441 and
ctrl+shift+м never matched the ctrl+shift+v paste binding.

- Report the kitty base layout key (the key at the same position in the
  PC-101 layout, derived from the physical key) when an application
  enables REPORT_ALTERNATE_KEYS, so ctrl+с is sent as `1089::99` and
  apps can match it as ctrl+c.
- When no key binding matches a textual key pressed with Ctrl, Alt or
  Super, retry with the same PC-101 key.

This branch has not been deployed

No deployments
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