1 Commits
Author SHA1 Message Date
ac82a9c2e8 bindings/dispatchers: Don't inherit key state modmask during key sym lookup (#15401)
* bindings/dispatchers: Don't inherit key state modmask during key sym lookup

Discussion: https://github.com/hyprwm/Hyprland/discussions/14772

In some cases, such as with bind -> sendshortcut, the key sym lookup
will fail resulting in a 'key not found' error when the cached xkb
state is used for lookup.

This can happen if, for example, the SHIFT key is bound in `hl.bind`.
Consider the following case, where SHIFT+1 is mapped to 2:

```lua
hl.bind("SHIFT + 1", hl.dsp.send_shortcut({mods = "", key = "2"}))
````

`resolveKeycode` will fail to lookup 2 because SHIFT is depressed in
the modmask.

Here, I've modified the lookup to use a fresh key state with no modmask.

After lookup, `ConfigActions::pass` will clear the modmask before
sending keys anyway, so an empty modmask can be used for lookup
in `resolveKeycode` safely.

* hyprtester/plugins: Update xkb state for test keyboard

* hyprtester/plugins: Add keybind_modmask plugin

This is different than keybind/keybind2 in that it takes a list of mods,
and applies the mods to the xkb state as well, which the other two do not.

* hyprtester/tests: Add set_shortbut bind tests involving SHIFT

---------

Co-authored-by: Max Asnaashari <max@masnax.org>
2026-08-01 13:27:09 +02:00