|
| 1 | +# Mac keyboard geometry |
| 2 | + |
| 3 | +Try Omarchy maps the host Mac keyboard class (ANSI / ISO / JIS) into the |
| 4 | +guest. That fixes the ISO Section / extra-ISO key inversion for every layout |
| 5 | +and, for xkeyboard-config's Mac vendor layouts (`ch de dk fi fr gb is it |
| 6 | +latam nl no pt se us` with an empty variant), selects Macintosh legends. |
| 7 | + |
| 8 | +## What the host does |
| 9 | + |
| 10 | +1. The compiled helper `omarchy-vm-helper --host-keyboard-geometry` reports |
| 11 | + `ansi`, `iso`, or `jis` via Carbon `KBGetLayoutType`. DMG users do not need |
| 12 | + Xcode or `/usr/bin/swift`. |
| 13 | +2. The launcher exports `TRYOMARCHY_KEYBOARD` and appends |
| 14 | + `tryomarchy.keyboard=ansi|iso|jis` on a normal VM launch (launch-time only, |
| 15 | + like `tryomarchy.ssh_access`). Recovery unsets that env and does not add |
| 16 | + the token. Inspect-only launches do not probe. |
| 17 | +3. QEMU Cocoa swaps Linux `KEY_GRAVE` and `KEY_102ND` only when |
| 18 | + `TRYOMARCHY_KEYBOARD=iso`. Missing env does not swap and does not |
| 19 | + re-query HID. Cached for the process so it cannot drift from the guest |
| 20 | + model. See [issue #67](https://github.com/omacom/try-omarchy/issues/67). |
| 21 | + |
| 22 | +ANSI and JIS never take the keycode swap. The helper reports `ansi` only |
| 23 | +for Carbon `kKeyboardANSI`. Unknown classes, a missing helper, or invalid |
| 24 | +output fail the launch instead of guessing. `--reset-storage-only` skips |
| 25 | +the probe. |
| 26 | + |
| 27 | +An external keyboard that reports a different class than the built-in board |
| 28 | +is classified at launch. Replug after boot does not change the guest model |
| 29 | +or the Cocoa swap for that run. |
| 30 | + |
| 31 | +## What the guest does |
| 32 | + |
| 33 | +`/usr/share/try-omarchy/apple-keyboard-input.lua` (seeded into new users' |
| 34 | +`~/.config/hypr/input.lua`) reads the cmdline token and sets only: |
| 35 | + |
| 36 | +```lua |
| 37 | +kb_model = "applealu_ansi" -- or applealu_iso / applealu_jis |
| 38 | +``` |
| 39 | + |
| 40 | +Omarchy's `XKBLAYOUT` / `XKBVARIANT` from setup are left unchanged. Upstream |
| 41 | +xkeyboard-config maps `applealu_*` onto Macintosh symbol maps for the Mac |
| 42 | +vendor layouts listed above when the variant is empty. Other layouts keep |
| 43 | +their PC symbols; they still get the ISO keycode correction. |
| 44 | + |
| 45 | +If the token is missing (older app builds), the guest does nothing. |
| 46 | + |
| 47 | +## Existing VMs after upgrading the app |
| 48 | + |
| 49 | +1. Install a Try Omarchy build that includes the Cocoa ISO patch and cmdline |
| 50 | + token. The keycode swap applies immediately. |
| 51 | +2. **Remove any local `frmac` (or similar) TLDE/LSGT symbol swap.** Keeping it |
| 52 | + after the host fix double-inverts those keys again. |
| 53 | +3. For Macintosh legends on an existing user config, set `kb_model` in |
| 54 | + `~/.config/hypr/input.lua` to `applealu_ansi`, `applealu_iso`, or |
| 55 | + `applealu_jis`. App upgrade does not install |
| 56 | + `/usr/share/try-omarchy/apple-keyboard-input.lua` onto an old disk; |
| 57 | + do not `dofile` that path unless a rebuilt guest image put the file |
| 58 | + there. |
| 59 | +4. Reload Hyprland (`hyprctl reload`). |
| 60 | + |
| 61 | +New factory users get the `dofile` from skel automatically. Omarchy |
| 62 | +*Setup → Input* rewrites `~/.config/hypr/input.lua`; re-add the `dofile` |
| 63 | +after that if you still want Macintosh legends. |
0 commit comments