Skip to content

Add BindingKind enum, migrate legacy mouse gesture bindings, and update UI#772

Merged
multiplex55 merged 1 commit intomasterfrom
codex/add-bindingkind-enum-and-update-bindings
Jan 31, 2026
Merged

Add BindingKind enum, migrate legacy mouse gesture bindings, and update UI#772
multiplex55 merged 1 commit intomasterfrom
codex/add-bindingkind-enum-and-update-bindings

Conversation

@multiplex55
Copy link
Copy Markdown
Owner

Motivation

  • Introduce explicit binding types for mouse gesture bindings so gestures can represent different behaviors (execute, set query, set query+show, toggle launcher) instead of relying on string prefixes or the legacy use_query flag.
  • Preserve backward compatibility by migrating schema v1 gesture files to a new schema v2 and map old use_query/action formats to the appropriate new BindingKind.
  • Surface binding kinds in the UI so users can pick the intended binding type and only edit relevant fields.

Description

  • Added BindingKind enum to src/mouse_gestures/db.rs with variants Execute, SetQuery, SetQueryAndShow, and ToggleLauncher, and set SCHEMA_VERSION to 2 with a LEGACY_SCHEMA_VERSION = 1 fallback.
  • Extended BindingEntry with kind: BindingKind and added action_string(), display_target() and updated to_action() to emit the correct Action (e.g., query: prefix, launcher:show, launcher:toggle) depending on BindingKind.
  • Implemented migration in load_gestures to accept legacy schema v1 JSON and map legacy LegacyBindingEntry (including use_query and launcher:toggle) to the new BindingKind and fields.
  • Updated binding search and display logic to use display_target() so searches and labels reflect the effective binding target.
  • Updated the binding editor in src/gui/mouse_gestures_dialog.rs to present a radio/segmented control for binding Type, show only the relevant fields per kind, and populate the editor when picking actions/queries from plugins or the app list.
  • Tweaked launcher activation in src/gui/mod.rs to handle launcher:show actions that carry a query in args and ensure focus behavior is applied correctly when those actions come from gestures.
  • Added/updated tests and test data to reflect the new BindingKind usage and migration behavior in tests/mouse_gestures_db.rs, and updated references in tests/mouse_gestures_ui.rs and tests/mouse_gestures_service.rs.

Testing

  • Ran cargo fmt to format code and ensure style consistency (succeeded).
  • Attempted to run the test suite with cargo test including the updated mouse gesture tests, but the build failed during compilation due to a missing native system dependency required by alsa-sys (pkg-config/alsa.pc not found), so automated tests could not complete in this environment.
  • New/modified tests added: gesture_db_migrates_legacy_schema (legacy v1 -> v2 migration), set_query_binding_avoids_execute_action (verifies SetQuery produces a query: action and does not invoke execute-action hooks), and updates to existing mouse gesture unit tests to include BindingKind in fixtures.

Codex Task

@multiplex55 multiplex55 merged commit 0e50865 into master Jan 31, 2026
1 check failed
@multiplex55 multiplex55 deleted the codex/add-bindingkind-enum-and-update-bindings branch February 1, 2026 00:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant