Skip to content

feat(gui): add custom-shortcut Tap/Hold recorder to the button picker - #1396

Merged
davidbudnick merged 4 commits into
AprilNEA:masterfrom
fahadjibransheikh:feat/mouse-custom-shortcut-recorder
Oct 10, 2026
Merged

davidbudnick merged 4 commits into
AprilNEA:masterfrom
fahadjibransheikh:feat/mouse-custom-shortcut-recorder

Conversation

@fahadjibransheikh

@fahadjibransheikh fahadjibransheikh commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Action::CustomShortcut / Action::HoldShortcut and the KeyCombo parser already exist end-to-end in openlogi-core (config schema, IPC, agent runtime dispatch), but there was no way to reach either from a physical button binding — the catalog picker deliberately excludes both, and the only shortcut recorder in the app lives inside the Actions Ring slot editor.
  • Adds a "Custom shortcut" section (Tap/Hold choice + free-text KeyCombo input) to the shared button-binding picker, so mouse buttons and the 5-direction gesture map (HapticPanel/GestureButton) can record a custom or held shortcut without hand-editing config.toml.
  • Came up pairing a haptic-pad button with a third-party hold-a-shortcut launcher (e.g. Droppy's Ring) — that binding was only reachable by hand-editing the config file before this change.

Changes

  • crates/openlogi-desktop/src/features/mouse/view.rs: MouseModelView gains shortcut_input/shortcut_hold fields (built the same way as the existing action_search), a set_shortcut_hold setter, and a localize_inputs helper (kept render() under the workspace's too_many_lines limit) that re-derives both inputs' placeholders on a live language switch.
  • crates/openlogi-desktop/src/features/mouse/inspector.rs: ActionPickerContext carries the two new fields; the shared action_library() (used by the plain-button, inherited-gesture, and gesture-direction inspectors) gets a new custom_shortcut_editor section appended after the catalog list, committing through the existing on_pick: &PickFn — no new commit plumbing.
  • crates/openlogi-ui/locales/*.toml (all 23): four new keys under [actions] — custom_shortcut, shortcut_placeholder, shortcut_hold, shortcut_tap — at the same position in every file. Non-English values are the English source text for now, per the i18n rule (Crowdin improves them later).

Testing

  • cargo fmt --all -- --check — clean
  • cargo clippy -p openlogi-desktop -p openlogi-ui --all-targets -- -D warnings — clean (one real finding along the way: MouseModelView::render crossed the 100-line too_many_lines limit after adding a placeholder call; fixed by extracting localize_inputs rather than suppressing the lint)
  • cargo test -p openlogi-desktop -p openlogi-ui — 221 tests pass, including locale_files_have_the_same_keys (catalog parity) and services::i18n::tests::typed_translation_keys_resolve
  • GUI exercised end-to-end against openlogi-agent-mock (real hardware wasn't reachable for this dev build — TCC permissions for an ad-hoc-signed bundle, a local dev-environment limitation, not something this diff touches): bound a plain button (Middle Click) to Hold+chord and a gesture-direction row (the same code path HapticPanel/GestureButton use) to Tap+chord, both committed and rendered correctly and distinctly.
  • Not runtime-tested on real hardware — the mock-agent verification above exercises the same code path, but real-device confirmation is the maintainer's call per AGENTS.md. Happy to attach screenshots from the mock-agent verification in a comment if useful.

@greptile-apps

greptile-apps Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain in the reviewed changes.

Summary

The picker now lets users choose Tap or Hold for a custom shortcut.

  • Mouse buttons and gestures can save custom shortcuts as taps or holds.

No new actionable issues were found in the changes since the previous review.

Reviews (5) · Last reviewed commit: "fix(gui): model shortcut mode as an enum" · Reviewed by Greptile

Comment thread crates/openlogi-desktop/src/features/mouse/view.rs Outdated
Comment thread crates/openlogi-desktop/src/features/mouse/inspector.rs Outdated
@fahadjibransheikh

Copy link
Copy Markdown
Contributor Author

Fixed both Greptile findings in 3936e3e:

  • Shortcut state persists: shortcut_input/shortcut_hold now reset in the same opening-branch of selection_card's click handler that already clears action_search, so switching to a different button/gesture-direction no longer shows a stale draft.
  • Invalid input fails silently: Add is now disabled while the current text doesn't parse as a KeyCombo (covers empty input, modifier-only combos, unknown keys, malformed separators). Needed a live-updating subscription on shortcut_input (mirroring the existing one on action_search) so the disabled state tracks each keystroke rather than only the last unrelated re-render.

cargo fmt --check, cargo clippy -p openlogi-desktop --all-targets -- -D warnings, and cargo test -p openlogi-desktop (218 tests) all green on the new commit.

Action::CustomShortcut and Action::HoldShortcut already existed end-to-end
in openlogi-core (parsing, IPC, agent runtime) but had no way to reach them
for a physical button binding — the picker's catalog deliberately excludes
both, and the only recorder in the app lived inside the Actions Ring slot
editor. Button bindings (mouse buttons, the 5-direction gesture map used by
HapticPanel/GestureButton) could only pick from the fixed catalog.

Add a "Custom shortcut" section to the shared action_library() picker (used
by button, inherited-gesture, and gesture-direction inspectors alike), with
a Tap/Hold choice and a free-text KeyCombo input mirroring the Ring editor's
existing recorder. Commits through the same PickFn every other row already
uses, so no new state-commit plumbing.

Comes up in practice pairing a haptic-pad button with a third-party
hold-a-shortcut launcher (e.g. Droppy's Ring) — currently only reachable by
hand-editing config.toml.
Two Greptile findings on the initial commit:

- shortcut_input/shortcut_hold on MouseModelView were stored once and never
  cleared, so opening the picker for a different button or gesture direction
  showed the previous target's half-typed shortcut, and Add could silently
  commit it to the wrong binding. Cleared in the same opening-branch of
  selection_card's on_click that already resets action_search.
- The Add button parsed KeyCombo and no-op'd silently on failure, giving no
  feedback for empty input, modifier-only combos, unknown keys, or malformed
  separators. Add is now disabled while the current input doesn't parse,
  requiring a live-updating subscription on shortcut_input (mirroring the one
  action_search already had) so the disabled state tracks each keystroke.
@fahadjibransheikh
fahadjibransheikh force-pushed the feat/mouse-custom-shortcut-recorder branch from 3936e3e to 9c1dddb Compare September 25, 2026 08:35
@davidbudnick davidbudnick added area: gui Graphical user interface platform: all Cross-platform issue type: feature New feature request labels Oct 9, 2026
# Conflicts:
#	crates/openlogi-desktop/src/features/mouse/inspector.rs
#	crates/openlogi-desktop/src/features/mouse/view.rs
#	crates/openlogi-desktop/src/features/mouse/view/tests.rs
@davidbudnick
davidbudnick self-requested a review as a code owner October 10, 2026 21:06
Co-authored-by: David Budnick <david@budnick.ca>
@davidbudnick
davidbudnick merged commit 44cf0e0 into AprilNEA:master Oct 10, 2026
23 checks passed
@aprilnea aprilnea Bot mentioned this pull request Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: gui Graphical user interface platform: all Cross-platform issue type: feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants