fix(keymap): repair refreshing behavior (niri), options not working and key rendering - #332
fix(keymap): repair refreshing behavior (niri), options not working and key rendering#332MateusAquino wants to merge 2 commits into
Conversation
…nd key rendering - Refresh requests issued while the panel was closed replayed on reopen and ran the parser inside the 25ms watch-callback budget, aborting mid-parse and pinning the snapshot at "loading" forever; refreshes now defer to the service update tick and the parsers run as coroutines with wall-clock-throttled slices. - merge_sequential silently never merged numbered Niri runs (every bind carries a fingerprint, which disabled merging); show_undescribed now also hides Niri binds with an empty or null hotkey-overlay-title. - Wide chords and merged rows render as distinct key pills (one line per combination) instead of collapsing into a single unreadable label. - Added merge_similar setting: same-action shortcuts fold into one read-only row listing every combo. - Unified the key display-name tables across Hyprland, Niri, and MangoWC.
|
waiting for @blackbartblues review |
|
I checked this again and found a few issues that I think should be fixed before merging. The biggest problem is the parser time slicing. It waits 12 ms before yielding, but Noctalia gives update callbacks merge_similar also has some correctness issues. Niri can merge different actions that use the same title. MangoWC can merge different sequential ranges because the merged ranges lose their action. Hyprland can merge unrelated undescribed Lua binds. The conflict checks also ignore bind.combos, which allows an existing shortcut to be added again. There are a few smaller issues as well, such as merged release binds being reported as press binds and long key All current tests pass, but the CPU tests do not actually measure the coroutine parser and do not force the multi I think the parser lifecycle, merged combo handling and related regression tests should be fixed before this is |
|
Thanks for reviewing @blackbartblues, if I understood everything correctly then 2aabbc6 should be it, yet I still have only tested it w/ Niri, would be nice if you could check for your Hyprland setup as well (specially the merge similar issue) :) Also:
Btw, I'm not sure if I'm able to edit |
Plugin
blackbartblues/keymapplugin.toml)What it does
Compatibility with other compositors had several major problems, notably: refreshing, loading indefinitely, inconsistent key names (eg.: XF86Calculator) and options which does not take any effect. This PR aims to fix these problems and add some improvements.
cc: @blackbartblues (maintainer)
Added
[Click to Expand]Newmerge_similaroption: shortcuts that trigger the same action (eg. "Close Window" onSuper+WandAlt+F4) collapses into a single read-only row listing every key combination.Fixed
[Click to Expand]Fixed panel stuck on "Loading keybindings" (tested on niri) after closing and reopening the panel: refreshes were replaying the full request backlog and execution is also deferred from the 25 ms state-watch callback into the service's own update tick, so a parse can no longer be aborted by a shared callback budget mid-flight. Note refreshing with the UI open was also not working (tested on niri);[Click to Expand]Fixed missing debugging logs/errors: Internal parser errors now surface their actual Lua error text on the error panel instead of an opaque "unknown error";[Click to Expand]Fixedshow_undescribed=trueoption, which was NOT hiding Niri binds whosehotkey-overlay-titleis missing, empty (""), ornullvalues;[Click to Expand]Fixedmerge_sequential=trueoption, which was NOT merging sequential keybindings (tested on niri);[Click to Expand]Fixed long keybindings being replaced with a single merged keybind.Changed
[Click to Expand]Unified the key display-name tables across Hyprland, Niri, and MangoWC so the same key reads identically for every compositor (ie. missing `XF86Calculator`, `XF86Mail`, touchpad scrolls, and punctuations on Niri/Mango service which was only present in Hyprland service).External dependencies
Unchanged:
hyprctl,niri,mango,mmsg,xdg-open(already declared inplugin.toml). No new external calls.Testing
niri_settings_test.lua(sequential merging, undescribed-title filtering, similar-action merging, refresh-watcher echo suppression),merge_similar_test.lua(MangoWC + Hyprland similar-action merging), andniri_scanner_test.lua(rewritten scanners checked byte-for-byte against the original implementations over a corpus plus 3000 fuzzed inputs).command_library_test.py,i18n_test.py).merge_sequentialon/off,show_undescribedon/off,merge_similaron/off.Compositors:
v5.0.0-beta.7Screenshots / Videos
There are screenshots on all of the expandable entries above in the PR.
Here's also a video showing how it was before (1.4.0) and after (1.5.0) patches on Niri.
Before
before.mp4
After
after.mp4
Checklist
idafter the/inplugin.tomlexactly.plugin.toml,README.md,thumbnail.webp, andtranslations/en.json.README.mdfollows theREADME template, documents
every entry id and dependency, and includes exact panel IPC commands and launcher prefixes where applicable.
thumbnail.webpwith the thumbnail generator.versionfollows semver and is bumped in this PR;plugin_apiis the oldest API level this plugin requires.understand that language well enough to review and maintain it (no unreviewed machine/LLM translations).
catalog.toml; CI generates it.Code review attestation
Plugins run as trusted, unsandboxed Luau in the user's session. Confirm:
licensedeclared inplugin.toml.