Skip to content

[fix] Map Mac keyboard geometry so ISO keycaps match in the guest - #190

Open
jean-humann wants to merge 1 commit into
omacom:mainfrom
jean-humann:fix/mac-keyboard-geometry
Open

[fix] Map Mac keyboard geometry so ISO keycaps match in the guest#190
jean-humann wants to merge 1 commit into
omacom:mainfrom
jean-humann:fix/mac-keyboard-geometry

Conversation

@jean-humann

@jean-humann jean-humann commented Sep 11, 2026

Copy link
Copy Markdown

Summary

Mac ISO keyboards deliver Linux KEY_GRAVE and KEY_102ND swapped through Cocoa, so @# and <> land on the wrong keys in the guest (#67). Omarchy setup French|fr is PC fr, so even correct keycodes show ² above Tab.

This detects ANSI / ISO / JIS once in the compiled omarchy-vm-helper and fails the launch on an unknown Carbon class. The same value is exported as TRYOMARCHY_KEYBOARD and appended as tryomarchy.keyboard=. QEMU Cocoa swaps those keycodes only when the env is iso. Recovery QEMU unsets the env and does not append the token. The guest sets only kb_model=applealu_*. Macintosh legends apply to xkeyboard-config Mac vendor layouts (ch de dk fi fr gb is it latam nl no pt se us) with an empty variant; the ISO keycode correction applies to every layout.

On an M3 Pro French AZERTY ISO host, a factory guest built from this branch (lock used locally, not committed) applied kb_model=applealu_iso with no frmac. Physical above-Tab typed @ / # and the extra ISO key typed < / >.

The runtime patch is checksum-pinned and applies after the existing Cocoa series. The upstream QEMU pin is unchanged (qemu_commit=c3d48b7d1e89604920e5b81b91140c2ad39a1943). Review the hash against macos/build-qemu-gpu-runtime.sh (iso_swap_patch_sha256):

shasum -a 256 macos/patches/qemu-cocoa-iso-section-grave-swap.patch

Expected: 57f33a5fb08fb90a7813b13bb7037a13198e4d7db230085b1faa28b284cf2387.

See docs/mac-keyboard.md.

Existing VMs

App upgrade applies the Cocoa keycode swap immediately. That uninverts ISO @# / <> without kb_model. Remove any local frmac TLDE/LSGT workaround or those keys invert again. Macintosh legends need kb_model: dofile the overlay if a rebuilt image installed it, otherwise paste the hl.config snippet in docs/mac-keyboard.md. Do not dofile a missing path.

Test plan

On an Apple Silicon M3 Pro (French AZERTY ISO), 3d686d2:

  • Patch SHA matches iso_swap_patch_sha256; QEMU pin unchanged
  • make doctor / make test (Lua guest test + compiled ISO swap)
  • make runtime — ISO patch applied last; staged macos/.build/qemu-gpu-runtime; TRYOMARCHY_KEYBOARD in QEMU
  • omarchy-vm-helper --host-keyboard-geometry prints iso
  • Factory guest from this branch (lock used locally, not committed): overlay + skel dofile present
  • Ephemeral VM: TRYOMARCHY_KEYBOARD=iso, tryomarchy.keyboard=iso, kb_layout=fr, kb_model=applealu_iso, no frmac
  • ISO FR physical keys: above Tab → @ / #; next to left Shift → < / >; keys do not invert
  • ISO DE
  • ANSI US (grave/tilde must not swap)
  • Existing VM: remove frmac after upgrade

Related to #67.

@jean-humann jean-humann changed the title Fix Mac ISO keyboard geometry for all guest layouts Fix Mac ISO keyboard geometry for Linux guests Sep 11, 2026
@jean-humann
jean-humann force-pushed the fix/mac-keyboard-geometry branch from 6025202 to 25398f8 Compare September 11, 2026 12:17
@jean-humann jean-humann changed the title Fix Mac ISO keyboard geometry for Linux guests [fix] Map Mac ISO keyboard geometry through the bundled helper Sep 11, 2026
@jean-humann
jean-humann force-pushed the fix/mac-keyboard-geometry branch 2 times, most recently from a8a603d to 24074e0 Compare September 11, 2026 12:51
Detect ANSI/ISO/JIS once in omarchy-vm-helper, fail closed on unknown
classes, and feed the same value to Cocoa and tryomarchy.keyboard= so
ISO Section/Grave keycodes match guest applealu_* models.

Related to omacom#67.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jean-humann
jean-humann force-pushed the fix/mac-keyboard-geometry branch from 24074e0 to 3d686d2 Compare September 11, 2026 13:29
@jean-humann jean-humann changed the title [fix] Map Mac ISO keyboard geometry through the bundled helper [fix] Map Mac keyboard geometry so ISO keycaps match in the guest Sep 11, 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.

1 participant