fix(gui): map MX Keys Mini controls to HID++ bindings - #1337
gmpandolfo wants to merge 4 commits into
Conversation
Mirror the MX Mechanical Mini fix (AprilNEA#1258) for the MX Keys Mini: rebuild the physical top row from the depot's semantic slots instead of overlaying a positional Esc/F1-F19 row, and route the dedicated media keys through per-device HID++ bindings. The Keys Mini has no navigation column and 10 top-row markers (backlight down/up, dictation, emoji, screen capture, mic mute, play/pause, mute, volume down/up). Backlight has no HID++ CID so it stays a native F-key alongside Esc and the three EasySwitch keys; the eight media keys, which already carry CIDs in KEYBOARD_KEY_CIDS, become rebindable per-device controls. No core/IPC/locale change: every ButtonId, CID, and translation key this needs already landed with AprilNEA#1258.
`Action::Sleep` maps to `action-icons/moon.svg` in the binding picker, but that file was never added to `ACTION_ICONS`, so every picker frame showing the Sleep entry logged `could not find asset at path "action-icons/moon.svg"`. The file was already vendored; only the registration was missing.
|
|
|
||
| let mut top_row: Vec<&Assignment> = assignments_for(asset, "device_keys_image").collect(); | ||
| top_row.sort_by(|a, b| a.marker.x.total_cmp(&b.marker.x)); | ||
| if easy_switch.len() != 3 || !(8..=12).contains(&top_row.len()) { |
There was a problem hiding this comment.
The MX Keys Mini has a fixed 10-slot device_keys_image row, but this check accepts any count from 8 through 12 without validating the expected semantic slots or their uniqueness. Because every accepted assignment is rendered, incomplete metadata can omit physical controls, while duplicate or unknown slots can become duplicate HID++ targets or positional global F-key bindings. Validating the expected 10-slot semantic set before enabling this layout would avoid misleading or incorrectly targeted hotspots.
Knowledge Base Used: Desktop application shell
|
Thanks for digging into this! It's superseded by #1604 (now on master), which keys keyboard controls by their HID++ control ID instead of adding one variant per key. The Keys tab now places keys by the control IDs in the device render's markers. Closing, but shout if something here isn't covered. |
Summary
Applies the same fix as #1258 ("map MX Mechanical Mini controls to HID++
bindings") to the MX Keys Mini (
mx_keys_minidepot, model id0xb369).Before, the Keys view drew a generic, evenly-spaced Esc/F1–F19 overlay (20
slots) on top of a keyboard that physically has ~14 keys in its top row, so
unbound keys looked bindable and the callouts did not line up with the real
key-caps. This rebuilds the row from the depot's semantic slot metadata and
routes the dedicated media keys through per-device HID++ bindings, exactly like
#1258 does for the Mechanical Mini.
The reconstructed row (14 hotspots):
Esc | F1–F3 (EasySwitch) | F4/F5 (backlight −/+) | Dictation | Emoji | Screen Capture | Mic Mute | Play/Pause | Mute | Volume Down | Volume UpBacklight down/up have no HID++ control ID, so they stay native F-keys next to
Esc and the EasySwitch keys. The eight media keys already have CIDs in
KEYBOARD_KEY_CIDSand translation keys in every locale, so this needs noopenlogi-corechange, noKEYBOARD_KEY_CIDSchange, no locale change, and noPROTOCOL_VERSIONbump — it is contained to the desktop GUI.Depends on #1258 — draft, do not merge yet
This is built on top of #1258, whose infrastructure it uses in full
(
BindingTarget,key_definitions,commit_target, per-device editor reset).The two commits
79d9ca80andf615b03don this branch are @aztkgeek's #1258,included only so the branch compiles; once #1258 merges I will rebase this onto
masterso the diff is just the MX Keys Mini commit(s).Changes
mx_keys_mini_definitions()infeatures/keyboard/function_row.rs— recognises model id0xb369, rebuildsthe top row from
device_easyswitch_image+device_keys_imageslots, mapsthe eight divertable media slots to their
ButtonId, keeps Esc / EasySwitch /backlight as global F-keys. New
mx_keys_mini_control()slot→ButtonIdmap(kept separate from fix(gui): map MX Mechanical Mini controls to HID++ bindings #1258's
semantic_top_row_buttonso the Mechanical Mini isuntouched). Short callout labels for the newly device-targeted buttons. Three
tests + a synthetic
mx_keys_mini_asset()mirroring the shipped depotmetadata.
action-icons/moon.svginACTION_ICONS— the filewas vendored and referenced by
Action::Sleepin the picker but neverregistered, so every picker frame showing Sleep logged
could not find asset at path "action-icons/moon.svg". (Also on its way via aseparate PR; harmless if it lands there first.)
Screenshots
Before — generic 20-slot Esc/F1–F19 overlay, keys don't match the hardware:
After — 14 real keys; the eight media keys are per-device HID++ controls,
Esc / EasySwitch / backlight stay native:
Testing
Local gate, on the #1258 base:
No wire-type, locale, or cfg-gated change, so those gates don't apply.
Runtime-verified on real hardware (MX Keys Mini, Bluetooth, Linux): the Keys
view renders the 14-key row aligned to the physical key-caps; binding Volume
Down / Screen Capture / etc. commits per-device and the HID++ divert takes
effect; unbinding restores native behaviour; switching devices clears stale
selection.