Okay, looping back to this –
I think I have figured out what is going on. Cross-platform keybinds work for two of the keys, but is broken for the third. This this is the mapping in Obsidian right now:
Code in hotkeys.json | Windows | Mac |
---|---|---|
Alt | Alt | Opt |
Ctrl | - | Ctrl |
Meta | Win | - |
Mod | Ctrl | Cmd |
If you do the standard thing on Mac for cross-platform keyboard sanity, you swap Cmd and Ctrl. Therefore, the Mod and Alt codes work perfectly as expected.
The trouble comes with the Ctrl and Meta codes
- Ctrl is never stored in Windows when you are setting hotkeys in the UI, but is interpreted as “Ctrl” in windows when it’s in the hotkeys.json file.
- Meta is never stored in Mac when you are setting hotkeys in the UI, but is interpreted as “Cmd” on mac when it’s in the hotkeys.json file.
These interpretations match how the browser interprets these codes. But, Obsidian uses a code to swap two keys used (Mod), and no code to swap them back. Therefore,
- If you hit all three on Windows, you store “Alt, Mod, Meta” in the hotkeys.json file. This is interpreted as “Opt, Cmd, Cmd” on Mac, breaking the hotkey
- If you hit all three on Mac, you store “Alt, Mod, Ctrl” in the hotkeys.json file. This is interpreted as “Alt, Ctrl, Ctrl” on Windows, breaking the hotkey.
While I believe this is a bug and will file a bug ticket for it, there is a solution for the time being that doesn’t involve using the .obsidian folder.
SOLUTION: Never use the Windows key (which is Ctrl on Mac) to map a hotkey.