URL Scheme doesn't work on Linux

Steps to reproduce

  1. Have two vaults vaultA and vaultB (no spaces in their names).
  2. vaultA has a note noteA
  3. With Obsidian closed, try to open an Obsidian URL either in the browser or through xdg-open:
    • obsidian://vault/vaultB
    • obsidian://vault/vaultA/noteA
    • obsidian://vault/vaultA
  4. With vaultA open in Obsidian try to open either of these:
    • obsidian://vault/vaultB
    • obsidian://vault/vaultA/noteA
  5. Try the absolute path to noteA
    • obsidian:///home/argen/vaultA/noteA

Expected result

With vaultA open in Obsidian

  • Opening the link for obsidan://vault/vaultA/noteA would open noteA
  • Opening the link for obsidian://vault/vaultB would open vaultB

Actual result

  • If Obsidian is closed, the last opened vault is opened.
  • If Obsidian is open, the vault picker is shown.

Environment

  • Operating system: Ubuntu 18.04 with gnome-flashback and i3
  • Obsidian version: 0.8.15, installer v.0.8.14

Additional information

My obsidian.destkop file located in ~/.local/share/applications/:

[Desktop Entry]
Name=Obsidian
Comment=Markdown Notetaking App
GenericName=Text Editor
Type=Application
Path=/home/argen/bin
Exec=Obsidian-0.8.14.AppImage %u
Icon=obsidian
StartupWMClass=obsidian
MimeType=text/html;x-scheme-handler/obsidian;

I also tried with the unpacked AppImage, and Exec pointing to the obsidian executable with the same result.

I have also ran the following:

xdg-mime default obsidian.destkop x-scheme-handler/obsidian
update-desktop-database

The output of both xdg-mime query default x-scheme-handler/obsidian and xdg-settings get default-url-scheme-handler obsidian is obsidian.desktop.

The relevant lines from my ~/.config/mimeapps.list:

[Default Applications]
...
text/html=obsidian.desktop
x-scheme-handler/obsidian=obsidian.desktop

The text/html mime type gets added whenever I open Obsidian, but I don’t think that plays a role here.

Edit: Looking a little closer at the mimeapps.list, something is not right here. Opening Obsidian makes it the default application for html files, instead of the browser. I don’t know if this is related, but this is definitely a bug. I don’t think Obsidian is intended to open other local html files, but even if it is it should be added to the [Added Associations] section instead of making it the default. In fact, double clicking a local html file behaves in a similar way as trying to open an obsidian link: if Obsidian is open, the vault picker is chosen or if it’s closed, the last vault is open.

3 Likes

I can confirm the URL handler is not working for me either on Linux. My desktop entry looks like this (I modified the default from snap to include MimeType and %u on Exec after a discussion with @argentum)

[Desktop Entry]
X-SnapInstanceName=obsidian
Name=Obsidian
Exec=env BAMF_DESKTOP_FILE_HINT=/var/lib/snapd/desktop/applications/obsidian_obsidian.desktop /snap/bin/obsidian %u
Terminal=false
Type=Application
Icon=/snap/obsidian/x1/meta/gui/icon.png
StartupWMClass=Obsidian
Comment=Obsidian
Categories=Office;
MimeType=x-scheme-handler/obsidian;

Same behavior for me as well! Ubuntu 20.04.

Same behavior here.

Tried also to open a file within a vault directly - here again (if obsidian was closed) the last opened file is shown…

Ubuntu Mate 20.04

Newbie here. Can you advise how much this impacts functionality? It sounds/reads to me as a major issue. I’ve just installed Obsidian on my Linux (Bunsen Labs: Debian-based) machine.

It doesn’t have any impact on obsidian’s functionality at all - the question is only if you can target specific notes in obsidian from other apps…

And this should be fixed with the new insider build 0.9.0!

Btw., for me it is still not working - still shows the vault picker! But maybe I didn’t do enough configuration, didn’t have the time yet to deal with it… Is the problem solved for others? @argentum @Philipp @mjedmonds

Not yet! There was an upstream fix that got merged today. Hopefully, that fixes it!

I second the problems outlined here. See my discord comments for steps taken and errors.

After some extensive testing I have found that this bug is caused by a “is-win32” check left in the code which skipped parsing of command line arguments on Linux. What a dumb mistake on my part, I’m really sorry!

Will be fixed in v0.9.2.

3 Likes

No worries! I’m happy you found it, looking forward to the update👍

Good news! Thanks for digging in on this issue, @Licat.

The bug that makes Obsidian hijack all text/html files in the mimeapps.list file still persists, though, and it is very annoying that I need to manually edit that file every time I want to view an HTML file from my desktop.

An app like Obsidian should definitely not touch a user’s default system settings for anything outside Obsidian’s own scope.

This is, unfortunately, a bug in xdg-utils (used by electron). See here for more details, and feel free to open a #bug-reports to track the upstream bug, but in the end, we depend on an upstream fix for this.