Platform specific hotkeys

Use case or problem

I use Obsidian on both Mac and Windows, (work computer and home computer), and the lack of different platform-specific hotkeys is driving me mad. I can’t use the built-in Sync system because of this issue, but I do sync across devices. This results in the same exact hotkeys.json file existing on every platform, and every night when I switch computers from work to home, I have to reconfigure my shortcuts. This seems like such a basic oversight. There is no other software I use across platforms that has global-multiplatform shortcuts.

There is a possibility I am doing something wrong and this is my fault that I haven’t figured out a way to do this.

Proposed solution

Use platform-specific shortcuts. Or at least, allow people to choose that option.

Current workaround (optional)

No workarounds.

Related feature requests (optional)

If this issue didn’t exist, I would still be using the official Obsidian Sync service, which allowed me to turn off sync of hotkeys on my Mac. Dropbox + Dropsync, and I assume every other popular sync service, has background sync on mobile, which is why I switched over. This was a dealbreaker feature for me.

1 Like

If you don’t want to use Sync, you can still use two different config folders.

Settings->about.

BTW, which hotkey are bothering you?
We have already some platform specific hotkeys.

1 Like

How do I select different config directories by platform? Also, this would add more headache, because if I go nuclear on not having the same config directory on all platforms, I would wipe my ability to sync plugins and everything else in the config. I still want to sync these things, just not the hotkeys file

I configure almost all of them to keep them consistent with other programs, namely VSCode.

I still don’t understand why you want different hotkey for windows and mac in the same vault? and which ones specifically.

I use the same keyboard across my mac and windows computers. I want the same combination of keys to execute the same operation across all programs I use to make the transition between these platforms not crazy-making. Mac and windows have different modifier keys. Command+C and Control+C for copy as an example. They both have a Control key however. I’ve gone through enormous lengths to standardize these, for example, swapping these modifier keys (Command is control and control is command) on the mac, so that they both have copy as the same key combination.

As a result, I need platform-specific hotkeys. I customize every hotkey from Obsidian defaults as far as I am aware. Here is a partial list of my customizations. My choices align with general standards for keyboard shortcuts in combination with some of the VScode defaults, my second-most-used program.

I am confused. Obsidian already handles ctrl on win/linux as cmd on mac (it’s internally coded as mod key).

Ok, upon re reading your message maybe you don’t want the above. It’s very peculiar choice and it won’t help your muscle memory. Anyway, now I understand where you are coming from.

1 Like

Thanks, I know this is a bit of a quagmire. Even more than the modifier key is the choice of what the Mac’s control and opt would map to on Window’s win and alt keys. One might think opt = alt, and ctrl = windows I guess, though an argument could definitely be made for the opposite, but when you plug the same keyboard into both platforms, this is not how it goes. (At least for the keyboard I use)

The fact that these diverged at some point, despite the rest of the keyboard UI being standardized is really a interesting point of history. Platform-specific hotkeys would really ease the burden of all of us being subject to Apple and Microsoft’s desires to bind everyone to a single platform in a cult-like fashion, hahaha. I’d 100% use Windows at work if mac wasn’t a requirement.

I experimented with changing the configuration folder under About, and see that it doesn’t affect all devices, so different devices can have different configurations and therefore different hotkeys. I’ll use that feature for now, even though that requires me to repeat making any plugin/other settings changes across each device whenever I do. Nevertheless, I’m grateful for solution that is less frustrating that where I started. Thanks.

I’ll still keep the feature request open though.

1 Like

I’m actually going to provide an alternative viewpoint. I think the choice to label the modifier as mod is great because it allows syncing and is an attempt to minimize how many hotkeys must be assigned. However, I think there should be a bool to undo that flip when on mac so it maps to control instead.

Outside of that I think Karabiner is a way to make mac behave like windows. However, I find it really hard to find satisfactory complex profiles for Karbiner. And scouring the json file is mind numbing.

Also, I wouldn’t use multiple configs with obsidian sync. Last I was told was that settings sync essentially only does 1 config folder; it doesn’t sync all of them.

1 Like

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.

It’s not a bug. What you have described is the intended behavior.

Sorry, maybe I am not understanding - Why is this the intended behavior when it breaks the ability to set hotkeys with all modifier keys pressed?

I don’t see it that way. There’s no ability to set hotkey with all modifier keys pressed because the modifier keys are different and there’s no equivalent meta/win key on mac.