MAC: Opening specific Obsidian vault other than last open when app is not already open fails

Steps to reproduce

  • Have multiple Vaults. (“test1”, “test2”, “test3”)
  • Open “test1”.
  • Quit Obsidian.
  • 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).

Expected result

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.

Actual result

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.

Environment

  • Operating system: macOS Catalina 10.15.7
  • Obsidian version: 0.9.10

Additional information

  • 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?
1 Like

I see someone else has bumped into this and “it is a known bug of Electron apps”:

Thanks

1 Like

Steps to reproduce

  1. Let’s say I have 2 vaults. VaultA and VaultB.

  2. I close VaultB. I then close VaultA last. VaultA is the last-closed vault.

  3. I have 4 test urls to open either the vault or a specific note:
    obsidian://open?vault=VaultA
    obsidian://open?vault=VaultB
    obsidian://open?vault=VaultA&file=Test.md
    obsidian://open?vault=VaultB&file=Test.md

  4. 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.

Expected result

The specified vault and/or note should open.

Actual result

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.

Environment

  • Operating system: MacOS
  • Obsidian version: 0.9.10

Additional information

1 Like

I think it’s a limitation of Electron. Related:

1 Like

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.

Cheers.

4 Likes

Steps to reproduce

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.

Expected result

Obsidian should open to the specified note.

Actual result

Obsidian opens but does not open the specified note.

Environment

  • Operating system: Mac OS Big Sur 11.0.1
  • Obsidian version: 0.10.5

Is this still happening?

@WhiteNoise When did this get fixed? I was having this problem too, but I just tested it now and can’t reproduce on 0.11.13 so it seems good now.

this was an electron problem not ours.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.