Skip to content

feat: Add double-click to set default device#36

Open
prabhanshu11 wants to merge 3 commits intotsowell:mainfrom
prabhanshu11:feature/double-click-set-default
Open

feat: Add double-click to set default device#36
prabhanshu11 wants to merge 3 commits intotsowell:mainfrom
prabhanshu11:feature/double-click-set-default

Conversation

@prabhanshu11
Copy link

@prabhanshu11 prabhanshu11 commented Jan 14, 2026

Summary

Implements double-click detection for mouse events as an opt-in feature. When enabled, double-clicking on a device triggers the same actions as right-click - selecting the object and setting it as default.

This improves mouse-driven workflows where users expect click-to-select behavior common in other TUI applications.

Commits

  1. feat: Add double-click detection infrastructure - Core implementation with config option (disabled by default)
  2. test: Add unit tests for double-click detection - 6 comprehensive tests
  3. feat: Add --double-click-select CLI flag - Runtime toggle for the feature

Implementation

  • Added last_click field to App struct for click tracking
  • Added double_click_select config option (defaults to false)
  • Modified MouseEvent::handle to detect double-clicks (within 400ms, 2px tolerance)
  • On double-click, lookup and execute right-click actions for that area
  • Added --double-click-select CLI flag for runtime enable

Usage

# Via CLI
wiremix --double-click-select

# Via config file (~/.config/wiremix/config.toml)
double_click_select = true

Tests

6 new tests covering:

  • single_click_stores_position: verifies click tracking works
  • double_click_within_threshold_resets_tracking: confirms double-click detection
  • clicks_outside_time_threshold_not_double_click: 400ms timeout works
  • clicks_outside_position_threshold_not_double_click: position tolerance works
  • clicks_within_position_tolerance_is_double_click: 2px tolerance accepted
  • after_double_click_next_click_starts_fresh: prevents triple-click issues

All 78 tests pass.

Closes #35

Adds the core infrastructure for double-click detection on mouse events.
When enabled via config, double-clicking (within 400ms, 2px tolerance)
on a device triggers the same actions as right-click - setting it as default.

Implementation:
- Added `last_click` field to App struct for click tracking
- Added `double_click_select` config option (defaults to false)
- Modified MouseEvent handler to detect double-clicks
- On double-click, lookup and execute right-click actions

The feature is disabled by default and can be enabled via config file
with `double_click_select = true`.
Adds comprehensive unit tests for the double-click detection feature:

- single_click_stores_position: verifies click tracking works
- double_click_within_threshold_resets_tracking: confirms double-click detection
- clicks_outside_time_threshold_not_double_click: 400ms timeout works
- clicks_outside_position_threshold_not_double_click: position tolerance works
- clicks_within_position_tolerance_is_double_click: 2px tolerance accepted
- after_double_click_next_click_starts_fresh: prevents triple-click issues

Also updates wiremix.toml to document the double_click_select option.
Adds a command-line flag to enable the double-click feature at runtime.
The feature remains disabled by default and can be enabled via:

1. CLI flag: wiremix --double-click-select
2. Config file: double_click_select = true

This makes the feature opt-in as requested, allowing users to explicitly
enable it if they prefer double-click behavior over right-click.
@prabhanshu11 prabhanshu11 force-pushed the feature/double-click-set-default branch from 9b8c949 to 195d32d Compare January 14, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Double-click to select/set default device

1 participant