Skip to content

fix: accept keycode-only modifiers in parse_mod - #1388

Merged
DreamMaoMao merged 1 commit into
mangowm:mainfrom
Dev-next-gen:fix/parse-mod-keycode-modifiers
Sep 11, 2026
Merged

DreamMaoMao merged 1 commit into
mangowm:mainfrom
Dev-next-gen:fix/parse-mod-keycode-modifiers

Conversation

@Dev-next-gen

Copy link
Copy Markdown
Contributor

The keys docs show binds that use keycodes as the modifier, like bind=code:64,code:24,killclient and bind=code:64+code:133,code:24,killclient, but neither of them loads. The config check prints Unknown modifier: code:64 and the bind is dropped.

In parse_mod(), the code: branch ORs the right modifier bit into mod but never sets match_success, so when every token is a keycode the function falls through to the !match_success path and returns UINT32_MAX. A mixed form like SUPER+code:50 only works because the named modifier sets the flag. This started with bcee63f (the config check added in 0.12.0), and since parse_mod() is shared it also affects mousebind, axisbind, gesturebind and the global keybinding window rule.

The fix sets match_success in the four recognised keycode cases, the same way the named-modifier branch does. An unknown keycode such as code:24 still ends up as an unknown modifier.

I checked it by compiling trim_whitespace() and parse_mod() straight out of parse_config.c into a small harness with stubbed wlroots constants. Before the change code:64 and code:64+code:133 return 4294967295, after it they return ALT and ALT|LOGO. ALT, SUPER+SHIFT, NONE, SUPER+code:50, code:24 and bogus give the same result either way. I did not build the full compositor, and the file passes clang-format unchanged.

AI tools used

@DreamMaoMao
DreamMaoMao merged commit 67bb2b2 into mangowm:main Sep 11, 2026
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Oct 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants