-
-
Notifications
You must be signed in to change notification settings - Fork 119
feat: add mouse buttons 6–9 as pickable actions #335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
a3b45fb
5f03283
95cf16a
531b051
c0109d5
c018d69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,11 @@ fn execute_linux(action: &Action) { | |
| // buttons ("back"/"forward") browsers handle natively. | ||
| Action::MouseBack => linux::click(KeyCode::BTN_SIDE), | ||
| Action::MouseForward => linux::click(KeyCode::BTN_EXTRA), | ||
| // Buttons 6–9 use the evdev extra-button codes beyond the side pair. | ||
| Action::MouseButton6 => linux::click(KeyCode::BTN_FORWARD), | ||
| Action::MouseButton7 => linux::click(KeyCode::BTN_BACK), | ||
| Action::MouseButton8 => linux::click(KeyCode::BTN_TASK), | ||
| Action::MouseButton9 => linux::click(KeyCode::BTN_0), | ||
|
Comment on lines
+80
to
+83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new Linux mapping mixes semantic side-button codes with the positional |
||
| // ── Editing ─────────────────────────────────────────────────────── | ||
| Action::Copy => linux::press_key(&[ctrl], KeyCode::KEY_C), | ||
| Action::Paste => linux::press_key(&[ctrl], KeyCode::KEY_V), | ||
|
|
@@ -185,6 +190,13 @@ fn execute_macos(action: &Action) { | |
| // 4 = forward / "button 5"). | ||
| Action::MouseBack => macos::post_other_button(3), | ||
| Action::MouseForward => macos::post_other_button(4), | ||
| // Buttons 6–9 (button numbers 5–8, 0-indexed). Same path as 4/5 — | ||
| // post_other_button stamps MOUSE_EVENT_BUTTON_NUMBER to address any | ||
| // button ≥ 3. | ||
| Action::MouseButton6 => macos::post_other_button(5), | ||
| Action::MouseButton7 => macos::post_other_button(6), | ||
| Action::MouseButton8 => macos::post_other_button(7), | ||
| Action::MouseButton9 => macos::post_other_button(8), | ||
| // ── Editing ─────────────────────────────────────────────────────── | ||
| Action::Copy => macos::post_key(VK_C, cmd), | ||
| Action::Paste => macos::post_key(VK_V, cmd), | ||
|
|
@@ -289,6 +301,18 @@ fn execute_windows(action: &Action) { | |
| Action::MiddleClick => windows::post_click(windows::MouseButton::Middle), | ||
| Action::MouseBack => windows::post_click(windows::MouseButton::Back), | ||
| Action::MouseForward => windows::post_click(windows::MouseButton::Forward), | ||
| // Windows SendInput carries flags for buttons 1–5 only; there is no | ||
| // flag for button 6+, so these log-and-skip (same pattern as the | ||
| // macOS-only navigation actions). macOS/Linux emit them natively. | ||
| Action::MouseButton6 | ||
| | Action::MouseButton7 | ||
| | Action::MouseButton8 | ||
| | Action::MouseButton9 => { | ||
| tracing::debug!( | ||
| action = action.label(), | ||
| "mouse buttons 6-9 are not supported on Windows — press ignored" | ||
| ); | ||
| } | ||
| Action::Copy => windows::post_key(windows::VK_C, &[windows::VK_CONTROL]), | ||
| Action::Paste => windows::post_key(windows::VK_V, &[windows::VK_CONTROL]), | ||
| Action::Cut => windows::post_key(windows::VK_X, &[windows::VK_CONTROL]), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When these actions run on Linux,
linux::clickemits key codes that the virtual uinput device does not advertise in its key capabilities. The existing side-button path registers its codes because the kernel silently drops unregistered events, soMouseButton6throughMouseButton9can be selected but produce no input on Linux.