Skip to content

#1866 fix: deduplicate binds by resolved combo and drop unreachable ones - #1870

Merged
kRHYME7 merged 2 commits into
HyDE-Project:devfrom
RAprogramm:1866
Jul 29, 2026
Merged

#1866 fix: deduplicate binds by resolved combo and drop unreachable ones#1870
kRHYME7 merged 2 commits into
HyDE-Project:devfrom
RAprogramm:1866

Conversation

@RAprogramm

@RAprogramm RAprogramm commented Jul 29, 2026

Copy link
Copy Markdown

Pull Request

Description

Fixes #1866

Problem

Three defects in the Lua keybinds, all silent: hyprctl configerrors stays
empty and the session starts normally.

  1. SUPER + CTRL + Left/Right carried two actions at once. Group navigation
    spelled the combo CTRL + Left, relative workspace navigation spelled the
    same physical combo CONTROL + LEFT, and both binds stayed live.
  2. ALT_R + CONTROL_R hid the bar. ALT_R is a keysym, not a modifier, so
    Hyprland dropped it and registered a bare right Control.
  3. Workspaces 11-20 on the numpad never fired. The Lua bind parser has no
    code:NN form, so all twenty binds registered with an empty key and a
    zero keycode.

Changes

hyde/binds.lua

  • Adds canonicalize, which reduces a combo to what Hyprland actually
    matches on: modifiers uppercased, aliases folded (CONTROL to CTRL,
    WIN/LOGO/MOD4 to SUPER, MOD1 to ALT), sorted, key last. The
    dedup key is now the canonical form, so spelling and order no longer hide
    a collision.
  • hyde.binds._active now stores the exact string a combo was registered
    with instead of true. Unbinding matches that literal string rather than
    the resolved key and modifiers, so without it dedup could not remove a
    bind that was first registered under a different spelling.

key_binds.lua

  • hyde.binds.dedup = true moves from the last line of the file to the
    first. It previously ran after every bind in the file had been registered,
    so only user overrides were ever deduplicated.
  • Drops the SUPER + CTRL + arrows group binds. Group navigation stays on
    SUPER + ALT + arrows, the combo goes to relative workspace navigation
    alone.
  • Hiding the bar moves to SUPER + CTRL + B.
  • The numpad table now holds keysyms instead of keycodes, and each workspace
    is bound under both keysyms its key can emit: the digit with Num Lock on,
    the navigation name with it off.

Verification

Loading key_binds.lua against a stubbed hl/hyde API, before and after:

binds defects
before 131 23
after 149 0

The 23 were one duplicate combo, twenty unreachable code:NN binds and the
two spellings of the right Control bind.

Live session on Hyprland 0.56.1 after hyprctl reload:

$ hyprctl configerrors
(empty)
$ hyprctl binds -j | jq '[.[] | select(.key=="")] | length'
0
$ hyprctl binds -j | jq -r '.[] | select(.key|test("CONTROL_R";"i"))' | wc -l
0
$ hyprctl binds -j | jq -r '.[] | select(.description|test("workspace 11$")) | "\(.modmask) \(.key)"'
64 KP_1
64 KP_End
65 KP_1
65 KP_End
$ hyprctl binds -j | jq -r '.[] | "\(.modmask)|\(.key|ascii_downcase)"' | sort | uniq -d
(empty)

The bind count difference is accounted for exactly: minus twenty broken
numpad binds, plus forty working ones, minus the two duplicate group binds.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (non-breaking change; modified files are limited to the documentations)
  • Technical debt (a code change that does not fix a bug or add a feature but makes something clearer for devs)
  • Other (provide details below)

Three key combinations change meaning, which users of the previous defaults
will notice: hiding Waybar moves off the right Control key onto
Super + Ctrl + B, and Super + Ctrl + arrows stops doing double duty. Both
were unusable as shipped, so nothing that worked before stops working.

Checklist

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My commit message follows the commit guidelines.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added a changelog entry.
  • I have added necessary comments/documentation to my code.
  • I have added tests to cover my changes.
  • I have tested my code locally and it works as expected.
  • All new and existing tests passed.

Tests for exactly these defects are in #1871, kept separate so this fix stays
reviewable on its own.

Additional context

pre-commit run passes on the files this branch touches. The repository has
244 files with pre-existing end-of-file and trailing-whitespace findings; they
are left alone here rather than folded into this change.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed duplicate Hyprland keybindings by canonicalizing modifier spellings and deduplicating registrations reliably.
    • Corrected Super + Ctrl + Arrow behavior to prevent unintended double group/workspace changes.
    • Updated Waybar hiding to Super + Ctrl + B to avoid accidental activation.
    • Restored responsive workspace navigation for workspaces 11–20 (including numpad mapping).

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 92ff177a-5046-4faa-9b49-8e2f2ef2e351

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 4dc6c88 and e2d6c64.

πŸ“’ Files selected for processing (3)
  • CHANGELOG.md
  • Configs/.local/share/hypr/lua/hyde/binds.lua
  • Configs/.local/share/hypr/lua/key_binds.lua

πŸ“ Walkthrough

Walkthrough

The Lua binding layer canonicalizes modifier combinations for deduplication, enables deduplication before registration, corrects the waybar shortcut, and uses keysyms for workspace 11–20 numpad bindings. The changelog records these Hyprland fixes.

Changes

Keybinding fixes

Layer / File(s) Summary
Canonical bind deduplication
Configs/.local/share/hypr/lua/hyde/binds.lua
Modifier aliases are canonicalized and sorted; deduplication stores and unbinds the exact registered bind string.
Early deduplication and modifier binding
Configs/.local/share/hypr/lua/key_binds.lua, CHANGELOG.md
Deduplication is enabled before bind registration, the hide-waybar shortcut uses MOD + CTRL + B, and the related fixes are documented.
Keysym-based numpad workspace bindings
Configs/.local/share/hypr/lua/key_binds.lua
Workspace 11–20 navigation and window-move bindings iterate over configured keysyms instead of code: values.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Poem

I’m a rabbit who hops through the binds,
Sorting modifiers into neat little lines.
Numpad keys now leap where they should,
Waybar hides with a combo that’s good.
Duplicate hops fade from the sceneβ€”
Clean Lua magic, crisp and green!

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title clearly describes the main fix: canonical deduplication of binds and removal of unreachable ones.
Linked Issues check βœ… Passed The changes address all three linked defects: canonical deduping, replacing the bare right-Control shortcut, and making numpad workspace binds reachable.
Out of Scope Changes check βœ… Passed The changelog note and bind config edits are all directly related to the reported keybind fixes.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

πŸ€– Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Configs/.local/share/hypr/lua/hyde/binds.lua`:
- Around line 57-65: Update the modifier canonicalization logic before sorting
in the visible binding formatter so repeated normalized modifiers are collapsed
into a set. Ensure inputs such as CTRL + CTRL + B and CTRL + B produce the same
deduplication ID, while preserving alias normalization, deterministic sorting,
and key handling.
πŸͺ„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 00634863-8d7e-4b96-b91b-42482894d732

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between bfa6487 and c90674f.

πŸ“’ Files selected for processing (2)
  • Configs/.local/share/hypr/lua/hyde/binds.lua
  • Configs/.local/share/hypr/lua/key_binds.lua

Comment thread Configs/.local/share/hypr/lua/hyde/binds.lua

@kRHYME7 kRHYME7 left a comment

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.

Made sense

@RAprogramm RAprogramm added the bug Something isn't working label Jul 29, 2026
@kRHYME7

kRHYME7 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

ready?

@kRHYME7
kRHYME7 merged commit 45226e6 into HyDE-Project:dev Jul 29, 2026
2 of 3 checks passed
@kRHYME7

kRHYME7 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

I should alos warn that some of the keybinds are layout specific example 3 finger swipe (touchpad) for scrolling windows. It needs to be specific if we want it up and down and window follows the fingers.. Cna you do a test for that please

@RAprogramm

Copy link
Copy Markdown
Author

Thanks for the review. Pushed one more change from the bot's catch: repeated modifiers are now collapsed before sorting, so CTRL + CTRL + B and CTRL + B land on the same dedup id. Nothing else in the fix moved.

@RAprogramm

Copy link
Copy Markdown
Author

On the gesture point β€” added it to the suite in #1871 rather than here, since this one is merged.

The harness now records hl.gesture calls the same way it records binds and checks four things: a finger count of 3 or more, a direction Hyprland accepts (horizontal, vertical, left, right, up, down, pinchin, pinchout, swipe), an action it accepts (workspace, move, close, fullscreen, float, special, resize), and no two gestures sharing the same finger count and direction. Those sets come from what Hyprland itself rejects at config load, not from the wiki.

The duplicate check is the one that matters for what you described. Hyprland reports an invalid direction or action as a config error, but says nothing when the same swipe is declared twice β€” the second one just shadows the first. So 3 fingers up -> workspace and 3 fingers up -> move currently coexist silently, which is exactly the up-and-down-must-be-distinct case.

Right now HyDE ships no gestures at all β€” the three examples in defaults.lua are commented out β€” so the case reports zero and acts as a guard for whatever gets added. Verified it bites by declaring bad gestures on a scratch copy:

fail: 3 fingers up is declared twice, as "workspace" and "move"
fail: gesture 3 needs a finger count of 3 or more
fail: gesture 3 has direction "diagonal", which Hyprland does not accept
fail: gesture 3 has action "scroll", which Hyprland does not accept

What I cannot test from the tree is whether the window actually follows the fingers β€” that is runtime behaviour on real hardware. If you want a rule like "a gesture moving windows must use a specific direction, never a bare axis", say so and I will encode it; I did not want to invent the policy.

@kRHYME7

kRHYME7 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

What I cannot test from the tree is whether the window actually follows the fingers β€” that is runtime behaviour on real hardware. If you want a rule like "a gesture moving windows must use a specific direction, never a bare axis", say so and I will encode it; I did not want to invent the policy.

Well the behavior I have now is I have 2 layouts scrolling and scrolling-down

image
260729_19h44m11s_recording.1.mp4

Okay we have capture some bugs on that video but you got the idea. I am swiping on the windows direction as it is intuitive for me.

@coderabbitai coderabbitai Bot mentioned this pull request Jul 29, 2026
16 tasks
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.

2 participants