You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix XKB keyboard remaps in terminal panes. Caps Lock remapped to Backspace now deletes text, and Caps/Escape swaps work in both directions.
Translate supported editing, function, and modifier keyvals to the native keycodes expected by the embedded Ghostty API. Preserve GDK's actual Caps Lock state, including when another key enables the lock. Modifier meanings that Ghostty cannot represent no longer fall back to sending the original editing key. Ordinary letter keys retain their physical identity for keyboard layouts and shortcuts.
Add unit coverage and GUI regressions that send physical key events through XKB and GTK on isolated X servers. Enable CI for pull requests and install the keyboard-test utilities in CI.
Validation
Build and 162 unit tests passed locally.
All 24 existing end-to-end tests passed.
Python suite: 13 passed; the optional live Codex test was skipped.
The original PR fails three new GUI regressions; the completed fix passes all four, including Colemak typing and Ctrl shortcuts.
Manually verified Caps-to-Backspace and both directions of Caps/Escape swapping on Hyprland/Wayland.
This also resolves the reported case in #3 (filed for caps:swapescape). Same root cause: the raw hardware keycode is forwarded to libghostty instead of one reflecting the post-XKB keyval, so the embedded Ghostty resolves the physical key and ignores the remap.
This patch is essentially fix (a) proposed in #3 — for a small set of named editing/navigation keys, translate keyval to the canonical evdev+8 keycode and pass that to ghostty_input_key_s. Escape is in the table, so the caps-to-esc direction that #3 reports (physical CapsLock should produce Escape) now works. The reverse half of swapescape (physical Esc producing Caps_Lock) is a modifier and out of scope here.
The broader fix (b) in #3 — build an xkb_keymap from the GDK display and hand it to libghostty so Ghostty's own resolution honors the full session layout — is more correct but more invasive. Happy to take that route instead if you'd prefer it.
Note this is orthogonal to #6: that PR fixes the printable-text / IME path (text_ptr, consumed mods) and never touches .keycode, so it does not address keycode-driven remaps. Both edit handleKeyEvent, so whichever lands first I am glad to rebase on.
Two confirmed reporters now via XKB-level remaps (this and #3), so it is not a one-off config.
no1msd
changed the title
fix: respect xkb keysym remaps for editing keys
fix: respect XKB keyboard remaps
Sep 9, 2026
Thanks for the patch, Ravi! I completed the modifier-state and reverse-swap handling and added regression coverage. The fix passed CI and manual Hyprland/Wayland testing.
Squashed and fast-forwarded to main as 0c12154, preserving your authorship.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix XKB keyboard remaps in terminal panes. Caps Lock remapped to Backspace now deletes text, and Caps/Escape swaps work in both directions.
Translate supported editing, function, and modifier keyvals to the native keycodes expected by the embedded Ghostty API. Preserve GDK's actual Caps Lock state, including when another key enables the lock. Modifier meanings that Ghostty cannot represent no longer fall back to sending the original editing key. Ordinary letter keys retain their physical identity for keyboard layouts and shortcuts.
Add unit coverage and GUI regressions that send physical key events through XKB and GTK on isolated X servers. Enable CI for pull requests and install the keyboard-test utilities in CI.
Validation
Closes #3.