feat: add mouse button 4 and 5 options#96
Open
NazarenoCavazzon wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — Adds two new bindable actions (MouseBack / MouseForward) that synthesize native mouse button 4/5 events instead of the keyboard-based ⌘[ / ⌘] shortcuts, along with a sentinel-based recursion guard.
MouseBack/MouseForwardactions — new variants added tolabel(),category(),catalog(), andexecute_macos()inbinding.rsSYNTHETIC_EVENT_USER_DATAsentinel — stamped on all synthesized mouse events to prevent re-entrancy; retrofitted ontopost_clickto close a latent MiddleClick re-entrancy holepost_other_buttonhelper — synthesizesOtherMouseDown/OtherMouseUpwith overriddenMOUSE_EVENT_BUTTON_NUMBER(3 / 4)- Recursion guard —
translate()inopenlogi-hookreturnsNonefor events carrying the sentinel, keeping the event in the stream - Native pass-through —
is_native_clickextended for(Back, MouseBack)/(Forward, MouseForward)so the genuine hardware button signals reach the OS without round-tripping through synthesis - i18n — translations for both labels in ja/ru/zh-CN/zh-HK/zh-TW
Big Pickle (free) (credentials for Anthropic not configured) | 𝕏
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.

Summary
Adds two new bindable actions — Back (Button 4) and Forward (Button 5) — that emit the real extra mouse-button events the OS and browsers interpret as back/forward natively, rather than synthesizing the ⌘[ / ⌘] keyboard shortcuts that BrowserBack/BrowserForward use.
Motivation
There was previously no way to bind a button to the actual mouse button4/button5 back/forward events. BrowserBack/BrowserForward send ⌘[ / ⌘], which many apps don't honor. Chrome and most macOS apps respond to the physical button4/5 instead — so this exposes that behavior as a first-class action.
BrowserBack/BrowserForward are left unchanged, so this is purely additive and non-breaking. The two new actions live in the Mouse section of the action picker, next to Left/Right/Middle Click.
Changes
Recursion guard
Synthesized events are posted at the HID tap location, so Ope Back → MouseBack binding would otherwise loop forever. Everysynthesized mouse event is now stamped with a EVENT_SOURCE_USER_DATA sentinel that the tap recognizes and ignores. This also closes a latent re-entrancy
hole for MiddleClick synthesis.
Testing
▎ Note: macOS event synthesis (execute) can't be covered by abuilding and binding a button to each action.
Follow-up (not included)
The default binding for the physical Back/Forward buttons is ard (⌘[). Switching the defaults to the new mouse-buttonactions would make Chrome/Finder back-forward work out of the box, but changes default behavior — left out of this PR by design.
solves: #80