Execute obsidian://vault/test2 or any obsidian://open… (make a test.html file somewhere with a link, open it in web browser and click link).
Executing any obsidian://open command (including shorthands) when Obsidian is not already open launches Obsidian and opens the requested Vault and/or File in that Vault.
Executing any obsidian://open command (including shorthands) when Obsidian is not already open launches Obsidian and if the last “top” open Vault is not the same as the Vault/File being requested, only the last “top” open Vault is opened, and nothing else.
I.e.: Obsidian is opened in it’s last state before being closed and the requested Vault/File—which is different from the last open Vault—is not opened. The request is effectively ignored or fails.
Operating system: macOS Catalina 10.15.7
Obsidian version: 0.9.10
The “open” state of Obsidian seems to require a vault to be loaded.
Closing all vaults exits the app. Last closed vault is perhaps saved as “default” or “last known top state” or something?
I close VaultB. I then close VaultA last. VaultA is the last-closed vault.
I have 4 test urls to open either the vault or a specific note:
If Obsidian is closed, clicking any of those urls will open the last-opened VaultA, and the last-opened note, and ignore anything in the url.
The specified vault and/or note should open.
If the Obsidian app is closed, clicking any of these links will open the last-opened vault and the last-opened note.
If Obsidian is already open, the specific vault or the specific note in the URL does open as expected.
One workaround, on Mac at least, is to use AppleScript applets to a) launch Obsidian and then b) invoke any obsidian:// URL command (open Vault, etc…)
(This will open whatever the last open Vault was first. No way around that I suppose.)
AppleScript code example:
tell application "Obsidian" to activate
tell application "Obsidian" to open location "obsidian://vault/Vault"
AppleScript can be invoked as little applets (use the “Script Editor” to make these), or as scripts via the Terminal (osascript /path/to/script). Raw AppleScript code can also be executed this way via Terminal, and any scripting language that supports calling osascript (shell, Python)
This is good enough for me, and opens other doors for exploration.
When using the URL Scheme to open a specific note, it will only work if Obsidian is already open. If obsidian is not currently running, opening the URL will open Obsidian, but not the specific note passed in with the URL.
If Obsidian is currently open, running the exact same URL again will cause the required note to open.
Obsidian should open to the specified note.
Obsidian opens but does not open the specified note.