Skip to content

Display mouse buttons in visualizer#346

Open
esphynox wants to merge 1 commit into
keycastr:mainfrom
esphynox:feature/mouse-button-acronyms
Open

Display mouse buttons in visualizer#346
esphynox wants to merge 1 commit into
keycastr:mainfrom
esphynox:feature/mouse-button-acronyms

Conversation

@esphynox

@esphynox esphynox commented May 28, 2026

Copy link
Copy Markdown

What (#345)

When the "With Current Visualizer" mouse display option is enabled, the keystroke visualizer previously rendered every mouse click as a single "🖱️" glyph, so viewers couldn't tell which button was pressed.

This change makes KCEventTransformer emit a button-specific token instead:

NSEvent type / buttonNumber Token
Left mouse LMB
Right mouse RMB
Other mouse, buttonNumber 2 MMB
Other mouse, buttonNumber ≥ 3 MB<N+1> (1-indexed)

Modifier prefixes still glue to the token, same as keystrokes: ⌘LMB, ⌥⇧RMB, etc.

Scope

  • Change is in the shared KCEventTransformer, so both the Default and Svelte visualizers pick up the new tokens automatically through, no per-visualizer code changes needed.
  • The mouse-pointer circle visualizer (KCMouseEventVisualizer) is unchanged.
  • Mouse-down only, matching existing behavior in KCDefaultVisualizer.addMouseEvent:.

Implementation

  • Added buttonNumber to KCMouseEvent, captured from NSEvent.buttonNumber in initWithNSEvent:.
  • Replaced the hardcoded 🖱️ string in KCEventTransformer.m with a switch on event.type plus a buttonNumber lookup for the "other" cases.

Demo

keycastr-mouse-button-number-demo.mp4

@akitchen

Copy link
Copy Markdown
Member

Thanks for the PR, looks reasonably clean and focused.

The question here was never about feasibility, but what should it look like? I'm not a fan of these tokens, I think they should be replaced with some iconography. And same is true of the mouse visualizer overlay.

@esphynox

Copy link
Copy Markdown
Author

Iconography first pass - wanted your read on direction before going further.

Used custom PDF assets since Emoji / SF Symbols has no per-button variants for icons.

Does the L/R/M direction work? Before we sort out edge cases like MB4+, worth confirming the basic icon style is what you had in mind.

Demo:

keycastr-iconography-test.mov

@esphynox esphynox changed the title Display mouse buttons as LMB/RMB/MMB/MB<N> Display mouse buttons in visualizer May 29, 2026
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.

2 participants