Skip to content

Render every modifier Hyprland can bind in the keybindings menu - #12042

Open
jimjimovich wants to merge 6 commits into
omacom:quattrofrom
jimjimovich:render-all-modifier-bits
Open

jimjimovich wants to merge 6 commits into
omacom:quattrofrom
jimjimovich:render-all-modifier-bits

Conversation

@jimjimovich

Copy link
Copy Markdown

omarchy-menu-keybindings renders a raw number instead of a modifier name for any bind that uses Mod2, Mod3 or Mod5.

modmask_to_text enumerated the sixteen SHIFT/CTRL/ALT/SUPER combinations and fell through to a numeric fallback for everything else. Hyprland can bind eight modifier bits, so the other three had no case and printed their mask.

Remapping Caps Lock to Hyper is the common way to hit this — caps:hyper binds on Mod3, so MOD3 + K shows up in the menu as:

32 + K                              → Keybindings cheatsheet

Reproduce

-- ~/.config/hypr/input.lua
hl.config({ input = { kb_options = "caps:hyper" } })

-- ~/.config/hypr/bindings.lua
o.bind("MOD3 + K", "Keybindings cheatsheet", "omarchy-menu-keybindings")

Then omarchy menu keybindings --print.

Fix

Derive the text from the bits rather than enumerating combinations, which covers all eight modifiers and shortens the function.

Testing

test/shell.d/keybindings-menu-test.sh passes, with two cases added: one that every modifier Hyprland can bind renders by name, and one that the masks the table already covered are unchanged.

All sixteen masks the old table covered render byte-identical, so nothing changes for a configuration that does not use Mod2/Mod3/Mod5.

The rest of ./test/shell was run as well. Three failures in my environment are unrelated to this change — bar icons share slot and baseline geometry reproduces on an unmodified quattro checkout, and the other two are the graphical bar suite and a check that wants a sibling omarchy-pkgs checkout I do not have.

modmask_to_text enumerated only SHIFT/CTRL/ALT/SUPER combinations, so a bind
on Mod2, Mod3 or Mod5 fell through to the numeric fallback and showed up as a
raw mask: remapping Caps Lock with `caps:hyper` binds on Mod3 and rendered as
"32 + K" instead of a modifier name.

Derive the text from the bits instead of enumerating combinations. The sixteen
masks the table already covered render byte-identical.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@llstrk

llstrk commented Sep 27, 2026

Copy link
Copy Markdown

Automated AI review

Community review: Independent automated community review, unaffiliated with the Omarchy team, intended to help prepare PRs for their review.

Verified: the premise and the main change hold. caps:hyper puts Caps Lock on Mod3, which Hyprland reports as modmask 32, so on the base a MOD3 + K bind renders as 32 + K. MOD2, MOD3 and MOD5 are the exact tokens Hyprland's Lua bind parser accepts, so the new text matches what users write in o.bind. All 16 masks the old table covered render byte-identical (old and new output compared for all 256 masks). The PR's test passes on the head and with the PR's two files on the current quattro tip, and the new Mod3 assertion fails on the base (it prints 32).

Three gaps remain: one modifier bit is still unnamed and is now dropped silently, existing menu caches keep the old text, and the new rows still cannot be launched from the menu.

Bit value 2 (CAPS) is not named and now disappears

Hyprland defines eight modifier bits (src/devices/IKeyboard.hpp, v0.56.2): SHIFT=1, CAPS=2, CTRL=4, ALT=8, MOD2=16, MOD3=32, META=64 (rendered SUPER), MOD5=128. The new loop names seven of them. Hyprland's Lua and legacy bind parsers both accept CAPS as a modifier. With the numeric fallback gone, any mask containing bit 2 renders as if that bit were not set:

Mask Base Head
2 2 (empty)
3 3 SHIFT
66 66 SUPER

End to end with a stubbed hyprctl binds, a SUPER + CAPS + J bind printed as a second SUPER + J row next to a real SUPER + J bind, and CAPS + H and H for the same action became indistinguishable: two identical H rows, merged into one when their records also match (dedupe_binding_records compares the rendered record).

Impact: a CAPS chord reads as a different, unmodified or already-taken chord. default/agents/skills/omarchy/hyprland.md tells the agent to use omarchy menu keybindings --print to check whether a key is already bound, so the wrong text can also mislead that check. CAPS binds are uncommon (with Omarchy's default compose:caps, holding Caps Lock gives modmask 0), but the PR's "every modifier" claim and the test title do not hold without it, and the code comment leaves CAPS out.

Suggested change: add '2:CAPS' to the list:

for modifier in '64:SUPER' '1:SHIFT' '2:CAPS' '4:CTRL' '8:ALT' '16:MOD2' '32:MOD3' '128:MOD5'; do

None of the 16 previously covered masks contains bit 2, so their output is unchanged, and the PR's test still passes with this line. An assertion such as modmask_to_text 66 == "SUPER CAPS" would cover it.

The records cache version is not bumped

output_binding_records serves keybindings-<key>.records from the cache directory whenever that file exists and is non-empty. keybindings_cache_key hashes only the literal v13, the active keymap line and the raw hyprctl binds output, and none of these change when modmask_to_text changes.

Reproduced with a shared cache directory and the same stubbed binds:

base, empty cache      -> writes keybindings-9f727f8f….records, prints "32 + K"
head, same cache       -> reuses the same file,               prints "32 + K"
head, v13 -> v14 only  -> writes a new file,                  prints "MOD3 + K"

Impact: users who already opened the menu with a Mod2/Mod3/Mod5 bind, the users this PR is for, keep seeing the raw number until their binds or keymap change or they clear the cache.

Suggested change: printf 'v14\n' in keybindings_cache_key. Eight of the nine commits to this file since the cache was added bumped this literal; the ninth removed a priority rule together with its bind. Several open PRs also bump it to v14, and identical bumps merge without a conflict, so whichever lands second should move past the value already on quattro.

Adjacent: the Lua scan cannot match the new modifiers, so the rows do not launch

Every o.bind goes through hl.bind, which Hyprland reports with dispatcher __lua. The menu recovers the real command from a source scan keyed on modmask, description and key. That scan's table (bin/omarchy-menu-keybindings line 85) knows only SHIFT, CTRL, CONTROL, ALT and SUPER, so for MOD3 + K it computes modmask 0 while Hyprland reports 32. The lookup misses, the dispatcher stays empty, and dispatch_binding returns 1 without doing anything.

In an isolated run with a minimal config binding MOD3 + K, CAPS + J and a SUPER + ALT + F12 control bind, the control row resolved on both base and head, while the MOD3 and CAPS rows had empty dispatch fields on both. With the table extended to the names Hyprland accepts, all of them resolved.

Impact: not a regression, since the base has the same gap, but the PR's own MOD3 + K example now renders by name and still does nothing when selected from the menu.

Suggested change: extend the table to match Hyprland's modFromSv (src/config/lua/bindings/LuaBindingsToplevel.cpp), here or in a follow-up:

local modifiers = {
  SHIFT = 1, CAPS = 2, CTRL = 4, CONTROL = 4, ALT = 8, MOD1 = 8,
  MOD2 = 16, MOD3 = 32, SUPER = 64, WIN = 64, LOGO = 64, MOD4 = 64,
  META = 64, MOD5 = 128,
}

With the stock config under the menu's stub, the scan currently stops at default/hypr/qconsole.lua before it reaches the user's bindings.lua, so no user Lua bind resolves there at all (same on base, head and tip). Open PR #13276 gets the scan past that point (#12712 and #12916 address other scan-stub issues). With #13276 applied, a SUPER user bind resolves but MOD3 + K still does not, since it does not change this modifier table.

Related PR: #11733 removes modmask_to_text and the Lua scan entirely, reading modifiers from their original spelling. It overlaps with this PR in both files.


Review information

Test scope: pinned head 1e6132a2, merge base 2fbac0c8 and quattro at 616feda1 (neither changed file differs between base and tip). test/shell.d/keybindings-menu-test.sh, an old/new comparison over all 256 masks and end-to-end --print runs with a stubbed hyprctl binds (output format read from Hyprland v0.56.2 source) ran in an isolated sandbox. The Mod3 premise was checked with xkeyboard-config and libxkbcommon in the sandbox. No live Hyprland session was used, and the full ./test/shell suite was not run, so the three unrelated failures the PR description mentions were not assessed. The suggested changes were tried only as local mutants to confirm they work.

AI process: Opus 5.5 Medium coordination and synthesis, Opus 5.5 Xhigh technical review and final fact check, GPT 6 Sol Xhigh search for related issues, Opus 5.5 Medium editorial check.

Opt out: To stop receiving these reviews, reply to this comment saying so.

@omarchybot omarchybot added the bug Something isn't working label Sep 27, 2026
omarchybot and others added 3 commits October 1, 2026 05:56
Both sides appended a case to the end of keybindings-menu-test.sh; both are kept.
…ndered

The cache stores rendered rows and is keyed on hyprctl binds, which this change does not alter, so a menu already cached as "32 + K" would keep showing it after the update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hyprland binds CAPS on bit 2. Deriving names from the bits without it turned a SUPER + CAPS + K bind into SUPER + K, where the old table at least showed 66.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Codex Medium <noreply@openai.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 1, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed and reproduced. The bug is real and this fixes it. I pushed three commits to your branch, and the head is now ba6a242b.

Reproduction, on a worker built from the Omarchy ISO, with a stubbed hyprctl binds reporting binds on masks 16, 32, 33 and 128 alongside all sixteen masks the old table covered: unmodified quattro renders 32 + K, 16 + N, 128 + M and 33 + J. This head renders MOD3 + K, MOD2 + N, MOD5 + M and SHIFT MOD3 + J. Restoring the old modmask_to_text brings the raw numbers back. The sixteen old masks render byte-identically to quattro.

Pushed:

  • 35bcff24 merges quattro in. Both sides had appended a case to the end of test/shell.d/keybindings-menu-test.sh, and both are kept.
  • f3cdab38 bumps the menu's cache key from v14 to v15. The cache stores rendered rows and is keyed on hyprctl binds, which this change does not alter, so anyone whose menu was already cached with 32 + K would have kept seeing it after updating. I reproduced that with a cache written by quattro; the bump clears it.
  • ba6a242b adds CAPS. Hyprland binds it on bit 2, and leaving it out of the bit list turned SUPER + CAPS + K into SUPER + K, where the old table at least showed 66. A test for mask 66 is added beside yours.

Tests, on the worker at ba6a242b: test/shell.d/keybindings-menu-test.sh passes 18 of 18. Your new assertions fail against the old function, so they are not vacuous. ./test/cli stops on four vscode-theme assertions (vscode generated theme references current theme file first). They fail identically on unmodified quattro and are unrelated to this change. With those four left out, the other 114 checks pass on both trees.

Second opinion: Codex at medium effort reviewed two rounds. In the first it found the dropped CAPS bit, which I had not, and that is fixed above. Its last round, on ba6a242b, found nothing open in this change and agreed it is proportionate. It had access to this session's transcript, so that agreement is not guaranteed to be independent.

Related, not part of this pull request: picking a bind from your bindings.lua in the menu does nothing on quattro today. That includes the MOD3 + K example in the description. The menu's Lua scan stops at default/hypr/qconsole.lua:123 (attempt to compare number with table) before it loads personal bindings, so those rows render without a command. Separately, the scan's modifier table at bin/omarchy-menu-keybindings:85 lacks CAPS/MOD2/MOD3/MOD5, which matters once the first problem is fixed. Both predate this change and are left for a fix of their own.

This is waiting on the maintainer. It is verified, but it can't be marked ready while the suite is red on quattro.

@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, though full-menu coverage for the newly named modifiers is still missing.

Findings

  1. P2 New masks lack menu coverage ▶

Summary

The PR replaces enumerated modifier combinations with bitwise formatting so the keybindings menu can name all eight Hyprland modifiers. It also invalidates cached records and adds focused formatter tests. The earlier request for a full-menu test remains unaddressed.

Reviews (2) · Last reviewed commit: "Merge quattro into render-all-modifier-b..." · Reviewed by Greptile

Comment on lines +239 to +250
eval "$(sed -n '/^modmask_to_text()/,/^}/p' "$ROOT/bin/omarchy-menu-keybindings")"

[[ $(modmask_to_text 32) == "MOD3" ]] ||
fail "a Mod3 bind renders its modifier by name" "$(modmask_to_text 32)"
[[ $(modmask_to_text 16) == "MOD2" ]] ||
fail "a Mod2 bind renders its modifier by name" "$(modmask_to_text 16)"
[[ $(modmask_to_text 128) == "MOD5" ]] ||
fail "a Mod5 bind renders its modifier by name" "$(modmask_to_text 128)"
[[ $(modmask_to_text 33) == "SHIFT MOD3" ]] ||
fail "a Mod3 bind combines with other modifiers" "$(modmask_to_text 33)"
[[ $(modmask_to_text 66) == "SUPER CAPS" ]] ||
fail "a Caps bind keeps its modifier rather than rendering as the bare key" "$(modmask_to_text 66)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 New masks lack menu coverage The new assertions check modmask_to_text by itself, but none pass a Mod2, Mod3, Mod5, or Caps bind through the stubbed hyprctl and keybindings --print path already used in this test. A full-menu case for MOD3 + K would catch parsing or record-formatting regressions that these assertions miss.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

quattro bumped the keybindings cache key to v16 and appended a translation test to the end of keybindings-menu-test.sh; this branch had bumped it to v15 and appended its modifier tests there. Both tests are kept, and the key moves to v17, since a menu cached at v16 by quattro still holds rows rendered with raw modifier masks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added verified Omarchy Triage has verified that this issue is ready for final review ready Good to merge labels Oct 14, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This stopped merging cleanly after quattro moved, so I merged quattro into your branch, and the head is now 74f16417.

The conflict: quattro had bumped the menu's cache key to v16 and added a translation test at the end of test/shell.d/keybindings-menu-test.sh, in the same places as this branch's v15 bump and modifier tests. Both tests are kept, quattro's new cache inputs (language, catalog, platform key names) are kept, and the key is now v17. Without moving past v16, a menu already cached on quattro keeps showing 32 + K after this lands, which I reproduced.

Reproduction, on a worker built from the Omarchy ISO, with a stubbed hyprctl binds on masks 16, 32, 33, 66 and 128: quattro at 84cfb939 renders 16 + N, 32 + K, 33 + J, 66 + C and 128 + M. This head renders MOD2 + N, MOD3 + K, SHIFT MOD3 + J, SUPER CAPS + C and MOD5 + M. Putting quattro's modmask_to_text back brings the numbers back. The modifier text goes through quattro's new translation and key-renaming steps unchanged.

Tests, on the worker: ./test/cli passes 125 of 125, the same as on quattro. test/shell.d/keybindings-menu-test.sh passes 21 of 21. Its translation case calls omarchy-language, which the worker's installed Omarchy predates, so it ran with the branch's own bin on the PATH. It fails the same way on quattro without that.

Second opinion: Codex at medium effort reviewed the merge and the change against the new quattro and found nothing. It agreed the change is proportionate. It could read this session's transcript, so that agreement is not guaranteed to be independent.

This is waiting on the maintainer.

@omarchybot omarchybot removed ready Good to merge verified Omarchy Triage has verified that this issue is ready for final review labels Oct 15, 2026
quattro bumped the keybindings cache key to v17 and added the leading keyboard layout to it, in the same lines where this branch had moved the key to v17. Both changes are kept and the key moves to v18, since a menu cached at v17 by quattro still holds rows rendered with raw modifier masks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Oct 15, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

This stopped merging cleanly when quattro moved again, so I merged quattro into your branch. The head is now 4fe909e5.

The conflict: quattro bumped the menu's cache key to v17 and added the leading keyboard layout to it, on the same lines where this branch had already moved the key to v17. Both changes are kept, and the key is now v18. If it stayed at v17, a menu quattro had already cached would keep showing 32 + K after this lands. I reproduced that on the worker, and v18 clears it.

Reproduction, on a worker built from the Omarchy ISO, with a stubbed hyprctl binds on masks 16, 32, 33, 66 and 128. quattro at c582e1d7 renders 16 + N, 32 + K, 33 + J, 66 + C and 128 + M. This head renders MOD2 + N, MOD3 + K, SHIFT MOD3 + J, SUPER CAPS + C and MOD5 + M. Putting quattro's modmask_to_text back brings the numbers back. Masks 0, 64 and 77 render the same as on quattro.

Tests, on the worker: ./test/cli passes 125 of 125, the same as on quattro. test/shell.d/keybindings-menu-test.sh passes 22 of 22. With the old function restored, your new assertions fail.

Second opinion: Codex at medium effort reviewed the merge resolution and the change against the new quattro and found nothing. It also checked all 256 masks and agreed the change is proportionate. It could read this session's transcript, so its agreement is not guaranteed to be independent.

It's verified at this head. It is waiting for CI to run on the new head, then on the maintainer.

@omarchybot omarchybot removed the verified Omarchy Triage has verified that this issue is ready for final review label Oct 15, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

The cause of the failed translation CI on 4fe909e53a20c6e071fb1a601aef927926f14988 remains unknown. Run 38670648246 exposes zero jobs and no check runs, and its log is unavailable. gh run view suggests a workflow-file issue, but provides no diagnostic that establishes one. This PR changes no workflow files, and I found no PR-specific test failure to fix.

I checked the workflow's test commands on a disposable worker built from the Omarchy ISO. python3 scripts/i18n-sync.py extract-scan --check passes. The structural i18n test exits after 349 passing assertions at the same locale-archive permission error on both this head and its merge base, c582e1d7f89887ec0be65f34081565a43e211d6a. The worker's installed locale generator uses localedef, which this older test's locale-gen stub does not intercept. That local failure does not explain the GitHub failure. The full suite and visual reproduction were not repeated.

GPT-6 in Codex (effort not exposed), Opus 5.5 High, and muse-wonder via pi at high thinking reviewed this CI diagnosis. Both reviewers found no branch change justified by this evidence; their agreement is not guaranteed to be independent.

No commits were pushed. This waits on the maintainer to investigate the GitHub workflow failure; the branch also conflicts with current quattro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants