Wow, that was a quick response! Don’t you, you know, celebrate the weekend?
Anyway: I just updated to the latest Hook and examined the “Get Address” for Obsidian (I can read AppleScript; just not write it). That’s some impressive bit of coding! Unfortunately it does not work for me though. It doesn’t actually change the implementation of the 3 modes that were described earlier in the article.
For now I think I want to settle on obsidian://
links, but using URLs that are a bit more stable than the default.
My script is a small improvement (IMHO) over the default (obsidian://
) implementation in two ways:
- It doesn’t use the clipboard (by not using the default Obsidian URL handler)
- It uses just the name of the file in the URL, not the full path. As it happens Obsidian can actually handle that just fine. (So:
obsidian://open?vault=a&file=/path/to/name.md
becomes obsidian://open?vault=a&file=name
).
This obviously doesn’t work if multiple documents in the same vault have the same name. But, I can live with that.
As for the “Hook to New”: I can’t make that work I’m afraid. I would need to know in which vault the file should be created, if any. Because the vault is part of the obsidian://
URL.
I believe there are two ways to really solve this:
- Not use Obsidian. I like Obsidian a lot, but I would definitely prefer an app that behaves better on macOS. I haven’t found one yet. I’m guess I’m still waiting for nvUltra to be released… Or for iA Writer to provide support for WikiLinks (basically that’s all I need).
- Find a way to use the much more stable
hook://file/
links with Obsidian.
One of my professors used to say: “Every problem can be solved with an indirection”. Over the years I’ve learned that to be true.
What I think we need is something like what “Choosy” is for web browsers: a file handler for Markdown files that, when triggered (e.g. from Hook) implements a bit of fairly simple logic:
- Is the file path inside an existing Obsidian vault?
- If yes: transform the path to an Obsidian URL and open that.
- If no: open the file in the preferred Markdown editor (e.g. iA Writer)
If we’d have that, most issues would be fixed, I think… Unfortunately this requires native macOS coding (in Swift) or something, which I do not master at the moment. Otherwise I would do it myself and stick it on GitHub.