macos: apply key-remap to menu key equivalents#12602
Conversation
bo2themax
left a comment
There was a problem hiding this comment.
Not exactly what I thought. I think you can check mappings and remap if needed in Config.keyEventIsBinding and CApi.config_trigger_ , it should also make the menu shortcut correct again, and you don't need to change the apprt anymore.
Refs ghostty-org#12293 Related: ghostty-org#3493 (duplicates: ghostty-org#4374, ghostty-org#5091), ghostty-org#7013 Supersedes: ghostty-org#12597 Apply `key-remap` before keybind lookup and when reporting keybind triggers for AppKit menu key equivalents. Previously, menu shortcuts were registered from the configured trigger without considering modifier remaps. This let AppKit consume the physical shortcut before Ghostty could match the remapped keybind. `Config.keyEventIsBinding` now remaps event modifiers before lookup, so remapped key equivalents match the same keybinds as normal key events. `CApi.config_trigger_` returns the physical trigger that maps back to the configured logical modifiers, and leaves triggers unset when no remapped physical shortcut can produce them. `RemapSet.unapply` performs the reverse lookup and is checked with `apply` so ambiguous or impossible remaps do not register incorrect menu shortcuts. Inspired by: @bo2themax (ghostty-org#12597 (review)) AI usage: OpenAI Codex helped investigate, implement, test, and refine this change. I reviewed and tested the resulting code.
e972523 to
a1f622e
Compare
|
@bo2themax Thanks for guiding me in this direction! I updated the implementation to apply I also tested this manually on macOS with:
With that config, the menu item for New Window displays |
|
@bo2themax How about this? |
It looks good to me in general, but we should wait for terminal maintainers to review this when they're available, since zig isn't really my profession here. Be patient plz, you can use your local build for now with |
|
@bo2themax So, can I assume that the issue you marked as “Changes requested” has been resolved? If so, I’d like to wait for other reviewers to review this as is. |
Refs #12293
Related: #3493 (duplicates: #4374, #5091), #7013
Supersedes: #12597
Apply
key-remapbefore keybind lookup and when reporting keybind triggers for AppKit menu key equivalents.Previously, menu shortcuts were registered from the configured trigger without considering modifier remaps. This let AppKit consume the physical shortcut before Ghostty could match the remapped keybind.
Config.keyEventIsBindingnow remaps event modifiers before lookup, so remapped key equivalents match the same keybinds as normal key events.CApi.config_trigger_returns the physical trigger that maps back to the configured logical modifiers, and leaves triggers unset when no remapped physical shortcut can produce them.RemapSet.unapplyperforms the reverse lookup and is checked withapplyso ambiguous or impossible remaps do not register incorrect menu shortcuts.Inspired by: @bo2themax (#12597 (review))
AI usage: OpenAI Codex helped investigate, implement, test, and refine this change. I reviewed and tested the resulting code.