Skip to content

feat(core): add the Calculator hotkey as a divertable keyboard key - #1465

Open
4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:feat/calculator-key
Open

4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:feat/calculator-key

Conversation

@4ni1ak

@4ni1ak 4ni1ak commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Rebase/adoption of #1247 (thorstent) onto current master — original PR went stale (CONFLICTING). Author preserved via git commit.

Adds ButtonId::KeyCalculator and (0x000a, ButtonId::KeyCalculator) to KEYBOARD_KEY_CIDS, making the Calculator hotkey bindable like the existing nine keyboard keys.

With the keyboard in macOS mode, the firmware emits no HID usage at all for this key (verified at the HID/evdev/libinput level on a real ERGO K860 — see #1247 for the full verification writeup), so diversion is the only way to reach it. In Windows mode it natively sends consumer usage AL Calculator (0x0192); binding it suppresses that native usage the same way the other divertable keys behave.

As for every entry in the table, an unbound key is never diverted — stock firmware behavior is unchanged unless the user explicitly binds it.

Changes

  • openlogi-core: append ButtonId::KeyCalculator (append-only per button.rs's own convention), grow KEYBOARD_KEYS to 10, add the display name + locale key across all 23 catalogs, default to Action::None.
  • openlogi-device: add (0x000a, ButtonId::KeyCalculator) to KEYBOARD_KEY_CIDS.

Testing

  • cargo fmt --all -- --check
  • RUSTFLAGS="-D warnings" cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
  • Not independently hardware-verified here — see feat(core): add the Calculator hotkey as a divertable keyboard key #1247 for the original author's on-device verification (ERGO K860 for Business, macOS + Linux + Windows mode comparison).

Fixes #1147
Closes #1247

Adds `ButtonId::KeyCalculator` and `(0x000a, ButtonId::KeyCalculator)` to
`KEYBOARD_KEY_CIDS`, so the Calculator hotkey can be bound like the existing
keyboard keys. Closes AprilNEA#1147.

Unlike the F-row keys the table was built for, this control sits in the hotkey
cluster beside the numpad (ERGO K860, MX Keys S) and is absent from the
Signature series. Diversion is the only way to reach it on macOS: with the
keyboard in its macOS mode the firmware emits no HID usage at all for this key,
so nothing above the HID layer has an event to intercept. In Windows mode the
same key natively sends consumer usage 0x0192 (`AL Calculator`).

CID and firmware task (`CALCULATOR`) cross-checked against Solaar's
`special_keys.py`, the same catalog the existing nine entries cite, and against
the Logi asset metadata slot `SLOT_NAME_CALCULATOR`.

As for every entry in the table, an unbound key is never diverted, so stock
firmware behavior is unchanged unless the user binds it.
@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge because unsupported or unbound Calculator controls remain native and diverted controls use the existing generic restoration lifecycle.

Summary

This PR adds the Calculator hotkey as an append-only bindable keyboard control while preserving native behavior for unbound or unsupported keys.

  • Adds ButtonId::KeyCalculator, its inert default, display label, and translation key.
  • Maps HID++ CID 0x000a to the new button identifier.
  • Advances the IPC protocol version to account for the shared enum change.
  • Adds the Calculator label to every shipped locale catalog.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
    B[User assigns Calculator binding] --> W[Watcher requests CID 0x000a]
    W --> C{Device advertises it as divertable?}
    C -->|No| N[Leave native behavior unchanged]
    C -->|Yes| D[Divert firmware control]
    D --> E[Emit KeyCalculator action events]
    E --> S[Binding removed, channel replaced, or watcher stops]
    S --> R[Restore original firmware reporting]
Loading

Reviews (1) · Last reviewed commit: "feat(core): add the Calculator hotkey as..."

@thorstent

Copy link
Copy Markdown

Thanks for the rebase. Will be great to have the button working on Mac

@4ni1ak

4ni1ak commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the original work and for confirming — hope it lands soon.

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 / Bug]: MX Keys S: Calculator key (CID 0x000A) not captured/remappable on macOS

2 participants