gtk: fix xkb mapping not working in Linux
Fix: https://github.com/ghostty-org/ghostty/discussions/8809#discussioncomment-14466017
If the physical key is non-remappable but is set to act as a remappable key in xkb layout, in the actual behavior, the key is dismissed by Ghostty (which is not the behavior in other apps).
With this modification, the key will be remapped if it is a remappable physical key or if the key it is remapped to is remappable.
This way, we respect the most possible the rules given by xkb, but we keep the non-remappable keys safe (cf previous bugs).
Does this solve all the bugs regarding XKB input? (e.g. Ctrl+ц behaving the same as Ctrl+C in a Russian layout, caps:swapescape works, etc.) If it does, then I'm happy to merge this, but we need to be very careful to not break existing workflows again.
It should not change the actual behavior. If you want to remap a letter to another letter, it will still be not allowed.
Before this fix, we only allow non-letter keys to be remapped. With this, we also add the letters keys that wants to act as a remappable key as allowed remappable keys.
Let me make more tests with Russian keyboard by reviewing the previous tickets. I'll keep you updated.
Thank you for the quick reply!
Hello,
I tested a russian keyboard, with these setups:
- ctrl:nocaps, altwin:swap_lalt_lwin
- caps:swapescape
ctrl-c , escape, return,.. is working all the time.
I also tried to replicate some behavior before/after and I got the same results in both current and this version.
Can you see other tests I could run ?
Thank you for your help!
Any news @pluiedev ? :-)
Thank you!
Ah sorry, I kind of forgot about this... At this point I couldn't really find anything wrong with this and I think we should let this go ahead and see if anybody complains, then we could either revert or revise this.
Thanks for investigating this!
For some reason there's no option to run CI on my end — could you try to amend/re-sign and then force push the commit? Maybe GitHub got stuck in some weird state that I can't resolve
Hello!
I amended the commit and signed it. I hope it can help. If not, I can create a new PR.
Thank you!
All good now. Must have been some weird GitHub bug