Skip to content

feat: support MX Master 4 haptic thumb-rest button#179

Open
baileywickham wants to merge 1 commit into
TomBadash:masterfrom
baileywickham:mx4-haptic-button
Open

feat: support MX Master 4 haptic thumb-rest button#179
baileywickham wants to merge 1 commit into
TomBadash:masterfrom
baileywickham:mx4-haptic-button

Conversation

@baileywickham
Copy link
Copy Markdown

@baileywickham baileywickham commented May 15, 2026

Add support for the MX master 4 hapic button on the thumb. Fixes #119

AI use:
Written with Claude's help, I reviewed the code myself before creating PR.

image

Promotes CID 0x01A0 from a "known but unsupported" control to a fully
mappable button. Wires the new `haptic` logical button end-to-end:
button name, event tuple, default mapping (none), v9→v10 migration,
HAPTIC_DOWN/UP events, divert_haptic flag, platform dispatchers, and
zh-CN/zh-TW translations.

Adds an MX4-specific entry to KNOWN_LOGI_DEVICES that overrides
supported_buttons to include `haptic`, registers `mx_master_4` in
_LAYOUT_BUTTONS, and removes 0x01A0 from _KNOWN_UNSUPPORTED_CONTROLS.
Adds a haptic hotspot to the catalog's MX Master 4 device layout
(coordinates pending tuning against the real render).

Refactors the engine's HID++ divert gating out of _setup_hooks into
_apply_divert_flags(), and calls it from _on_connection_change on the
connect leg only — the disconnect leg would race against the hook's
device-keyed haptic divert and loop. Adds HidGestureListener.
update_extra_diverts() so the engine can swap the divert set on a
live listener (needed when the MX4 connects mid-session).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@baileywickham
Copy link
Copy Markdown
Author

baileywickham commented May 15, 2026

cc @hieshima or @TomBadash for review, let me know if you have any issues with it, happy to make updates

Comment thread core/engine.py
else:
self.hook.register(evt_type, self._make_handler(action_id))

def _apply_divert_flags(self):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled out because reload_mappings never pushes the mappings to the Listener while running, this should fix that issue.

@TomBadash
Copy link
Copy Markdown
Owner

Hi @baileywickham, thank you for this PR! The button mapping foundation is solid and well-tested -- great work getting that in.

After reviewing it, I think there are a few MX Master 4-specific features still missing that would make this feel complete:

Haptic feedback itself -- triggering the physical haptic motor when the button is used
Haptic intensity control -- letting the user choose the feedback level
A dedicated MX Master 4 page for these settings
I've actually been working on some of this in the test-mxm4 branch for a while, which already has partial support for a few of these things. I'd love for us to collaborate rather than duplicate effort.

In particular, two things I'd appreciate help thinking through:

Which actions should trigger haptic feedback and how to let the user configure that (currently I have DPI cycle, task view, and smart scroll toggle wired up)
A master on/off toggle for haptic feedback, ideally from a dedicated settings page
Would you be open to either building on top of test-mxm4, or coordinating so we can fold your changes in?
Really appreciate the contribution.

@baileywickham
Copy link
Copy Markdown
Author

Hey @TomBadash, yeah, I'm happy to help merge this into your branch/work with you on it. Let me take a look and get back to you with some ideas!

@TomBadash
Copy link
Copy Markdown
Owner

@baileywickham great to hear that!

Make sure to pull the latest version of the branch, I just pushed a few new updates.
Take a look when you have time and let me know how you think we can improve or refine the behavior together.

@baileywickham
Copy link
Copy Markdown
Author

@TomBadash, sorry about the delay, I got distracted. Looks like you're branch has superseded my work! If you're still looking for help/opinions, let me know and I can take a look this weekend. Happy to help!

@MightyDillah
Copy link
Copy Markdown

I just wanted to say that @TomBadash you're doing gods work helping people move away from that cancer of a software.. i tested this PR (maybe the fix is in another PR?) but the 3rd button on the side is still being recognized as the gesture button. I'd be happy to test if you guys need help! just wanted to say thanks.

side note: I also found that the smooth scrolling and some other options are hardware level (or at least they can be turned on that way) i could be wrong though.

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.

[Device] MX Master 4 haptic button

3 participants