Conversation
Foundation for the keybind rework: a single Hotkey type carrying a set of held modifiers plus a trigger that can be a keyboard key, a mouse button, or a wheel notch — replacing the scattered single-key + optional-single-modifier fields. Exact-set modifier matching (so Ctrl+J doesn't fire a bare-J bind), sorted/deduped mods for stable serialization, and TOML round-trip. Wired into the bind sites + UI in following commits.
Replace the per-character modifier dropdown + separate hotkey row with one compact keybind chip (left-click to record, right-click to clear, tooltip). Captures full modifier chords (Ctrl+Shift+J) into the unified Hotkey type; the keyboard listener matches them with exact-set modifier comparison. Mouse/wheel triggers and rollout to the other bind sites follow.
The keybind chip now records mouse buttons and wheel notches, with held modifiers (Ctrl + Mouse4). A shared held-modifier set, written by the keyboard listener and read by the mouse listener, makes mouse/wheel chords work even though the two listeners poll separate evdev devices. The mouse listener resolves and fires per-character mouse/wheel hotkeys (staying attached for them even when side-button cycling is off). iced buttons map to evdev BTN_* codes (Linux) / XBUTTON numbering (Windows).
Forward, backward and toggle-overlay now use the same keybind chip as the per-character bindings — key chords, mouse buttons, or wheel notches — instead of a key field plus a modifier dropdown. The separate modifier_key / toggle_previews_modifier fields are gone: backward is just its own chord (default Shift+forward) and each binding carries its own modifiers. - config: forward_key / backward_key / toggle_previews_key are now Hotkey; modifier_key and toggle_previews_modifier removed. - keyboard listener matches them via exact-set modifier comparison. - mouse listener fires mouse/wheel-bound cycle, toggle and character hotkeys (wheel-to-cycle), sharing the held-modifier set; toggle flips show_previews. - panel: chip + right-click-clear + tooltip at every bind site; dead modifier dropdown code removed.
- windows_helpers: plan_cycle_hotkeys / plan_character_hotkeys now take Hotkey, emit a modifier *chord* (Vec<ModifierKind>) per registration, and skip mouse/wheel and unbound bindings (the mouse hook handles those). Adds a Win modifier. Tests updated. - windows_input: RegisterHotKey gets the full chord via an OR'd fsModifiers mask; toggle-overlay registers from its Hotkey; per-character unchanged in spirit. XBUTTON cycle path is untouched. - config: drop the obsolete CharacterHotkey struct; daemon rebind signature follows the new fields. Note: built and tested on Linux; the Windows cfg path is migrated to pattern but not compiled here (no MinGW to cross-build ring). Windows mouse/wheel-bound character/toggle hotkeys still need wiring into the low-level mouse hook.
- Keyboard Bindings: cycle bindings are now Hotkey tables (mods/kind/code); modifier_key is gone (backward is just its own chord). - Document the keybind chip (left-click record, right-click clear) at every bind site, and mouse-button / wheel triggers incl. wheel-to-cycle. - character_hotkeys TOML shape updated to the Hotkey fields.
forward_key / backward_key / toggle_previews_key changed from a bare key code to a Hotkey table, which would make pre-upgrade config.toml files fail to parse. Accept either form on read (a bare integer becomes a plain-key Hotkey); removed fields like modifier_key are simply ignored. Saves rewrite in the new format.
The low-level mouse hook now resolves mouse-button and wheel triggers against the configured bindings (cycle, toggle, and per-character), not just the legacy XBUTTON cycle: - windows_helpers::resolve_mouse_action (unit-tested on Linux) maps a trigger + held modifiers to an action, mirroring the Linux mouse listener's priority. - The hook reads held modifiers via GetAsyncKeyState, handles WM_XBUTTONDOWN and WM_MOUSEWHEEL, and posts cycle / toggle / character messages to the listener; bindings refresh on every (re)register so panel edits apply live. - The legacy enable_mouse_buttons XBUTTON cycle remains as a fallback. Closes the previous gap where mouse/wheel bindings were captured but inert on Windows. Logic is tested on Linux; the Win32 glue is migrated to pattern but not compiled here (no MinGW to cross-build ring).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reworks how every keybinding is set and what a binding can be — one widget, used at every bind site.
Input widget
Ctrl+Shift+J), a mouse button, or a wheel notch — not just a bare key.Model
Hotkeytype (modifier set + key/mouse/wheel trigger) replaces the oldCharacterHotkeyand the separatemodifier_key/toggle_previews_modifierfields. Backward is now just its own chord (defaultShift+forward) instead of a shared-key + modifier trick.Linux runtime
Windows runtime
RegisterHotKeygets the full chord via an OR'dfsModifiersmask (addsWin); toggle-overlay registers from itsHotkey.GetAsyncKeyStatemodifiers) against the configured cycle / toggle / per-character bindings and posts them to the listener; bindings refresh on every re-register so panel edits apply live. The legacyenable_mouse_buttonsXBUTTON cycle remains as a fallback.windows_helpersand is unit-tested on Linux.Config compatibility
forward_key/backward_key/toggle_previews_keyand[character_hotkeys."Name"]are nowHotkeytables (mods,kind,code). Pre-upgrade configs that stored a bare integer key code still load (the integer becomes a plain-key binding); the removedmodifier_key/toggle_previews_modifierkeys are ignored.README updated for the new binding model.
Note