input: xkb: ignore virtual modifiers

Some compositors (mutter/GNOME is one) adds _virtual_ modifiers to the
set of active modifiers when e.g. Alt, Meta, Super or Hyper is
pressed. For example, pressing Alt+b would result in *both* the Alt
*and* the Mod1 modifier being set.

Since foot makes close to zero assumptions on how the modifiers should
be interpreted, this causes various breakages.

For example, a foot shortcut defined as Mod1+b will not match, since
the Alt modifiers is also set. This has forced users to
redefine/override some of the default key bindings to include the
additional modifiers.

It also causes issues with the kitty keyboard protocol, for some key
combinations. Mainly whether or not to use unshifted key or not,
resulting in incorrect escape sequences.

Since all the "real" modifiers are always set as well, we can safely
ignore the virtual modifiers.

Closes #2009
This commit is contained in:
Daniel Eklöf 2025-03-29 10:34:40 +01:00
parent c8470f40c1
commit 58910856c8
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 66 additions and 0 deletions

View file

@ -68,8 +68,20 @@
colors has not configured) is now done by linear RGB interpolation,
rather than converting to HSL and adjusting the luminance
([#2006][2006]).
* XKB: virtual modifiers are now ignored. This works around various
issues seen when running foot under mutter (GNOME) ([#2009][2009]):
- Some key combinations generating the wrong escape sequence in the
kitty keyboard protocol.
- some of foot's default shortcuts not working (mainly those using
`Mod1`) out of the box.
- **Note: if you have custom key bindings in `foot.ini` that
includes one or more of the `Alt`, `Meta`, `Super`, `Hyper`,
`NumLock`, `ScrollLock`, `LevelThree` or `LevelFive` modifiers,
you need to update them; i.e. remove the virtual modifier(s),
leaving only the real modifiers (`Mod1`, `Mod2` etc).**
[2006]: https://codeberg.org/dnkl/foot/issues/2006
[2009]: https://codeberg.org/dnkl/foot/issues/2009
### Deprecated