Obsidian URI set up for Linux / obsidian.desktop

I don’t use the AppImageLauncher, but here Meta Post - Linux tips, tricks & solutions to common problems are details of where to add the desktop file.

1 Like

Thank you I’ll try it out!
update: it didn’t fix it for me, URI is still not working

Here’s what my setup looks like, maybe it will be helpful to you.

  • I’m running Linux Ubuntu 20.04.
  • I’m not using any special AppImage manager.
  • I downloaded the Linux AppImage and put it in /home/craig/Programs/obsidian
  • I extracted obsidian.png from the AppImage using --appimage-mount and put it in the same folder as the AppImage. To save you the trouble, I attached obsidian.png at the bottom of this post.
  • I created a desktop file obsidian.desktop in /home/craig/.local/share/applications/. The contents of the file are below. You’ll need to change the paths to match wherever you put your obsidian.AppImage file. Make sure there are no spaces between e.g. Exec= and /home/... Also make sure to keep the %u – that’s the special sauce.
  • I think that’s it! With this setup I can start Obsidian from the launcher, and obsidian:// links work for me in Chrome, Obsidian, and Mermaid. (Example Mermaid block with both kinds of links copied below.)

/home/craig/.local/share/applications/obsidian.desktop:

[Desktop Entry]
Name=Obsidian
Exec=/home/craig/Programs/obsidian/Obsidian-0.8.15.AppImage %u
Terminal=false
Type=Application
Icon=/home/craig/Programs/obsidian/obsidian.png
StartupWMClass=obsidian
X-AppImage-Version=0.8.15
Comment=Obsidian
Categories=Office;
MimeType=text/html;x-scheme-handler/obsidian;

Example graph with both kinds of links:

graph LR;
sed --> Obsidian;

click sed "obsidian://vault/Reference/sed";
click Obsidian "obsidian://open?vault=Reference&file=Obsidian";

obsidian.png:

5 Likes

I have basically the same setup, but the step above is not needed imo (Ubuntu 18.04, ymmv)

Thanks for the feedback! What setting do you have for the icon in your obsidian.desktop file?

I saved the icon in ~/.icons/obsidian.png, but I’m also on i3 using rofi, so I don’t really need the icon :stuck_out_tongue_winking_eye:. The details of my setup are over here:

1 Like

thank you @Craig for the detailed description it really helped a lot!
and thanks @argentum as well appreciate the tips for the obsidian.png

Currently it worked, but I’m having some strange behaviour

For instance on mermaid if I click here:

(The following is @Craig’s mermaide code modified for my vault)

graph LR;
sed;

click sed "obsidian://vault/obsidian-personal/sed";

Obsidian does two weird things

If the file already exists

It opens it, but then it does two unecesary annoying extra steps

  1. It opens a prompt to

if I click on “Remeber my choice” I get this message

This is saying I can change this from “Firefox Preferences”

After I click “Remember Choice” I don’t get that annoying message anymore.

Any ideas on where in Firefox Preferences could I find this?



Firefox Tab Opens everytime

After a mermaid link works correctly
I get a new tab opened everytime in firefox with the following text on the URL:

obsidian://vault/obsidian-personal/test

It shows this everytime I open a link.

I have no idea why this is, but I also notice that if I open the command palette and try “Show In Folder” this opens in firefox as well (with a structure of my files in the browser)

It does this instead of opening this in my linux file manager. In my case I use Thunar

I’m not sure if that’s related, but the new tab opened with every link is my main concern now.


Question about creating vs opening mermaid files

Like I mentioned earlier, if I click on a mermaid link it doesn’t work unless the file already exists, is this normal behaviour?


Thanks again for the great help, really appreciate it

I couldn’t reproduce. I’ve seen the prompt when clicking on an obsidian link from another app (Todoist if that matters, electron-based too), but I don’t have the option there to remember my choice. Maybe it’s a GNOME thing? (My version is 3.28.2).

What are the outputs of xdg-mime query default x-scheme-handler/obsidian and xdg-settings get default-url-scheme-handler?

Where does Obsidian show up in your ~/.config/mimeapps.list?

RE: Opening non-existing files is not possible:

Edit: You can check what Firefox is doing in its settings:

Got you this makes sense


this is what the terminal returns:

appimagekit_c2a39878767986b435d0a31ec4395864-Obsidian.desktop

this one doesn’t return anything, not sure why

It shows at the very end of a list of files under this
[Default Applications]

itshows the following

handler/obsidian=appimagekit_662bbdc1ca79f8d4ec9971260b077778-Obsidian.desktop


it’s very strange, I don’t use GNOME. I’m on Manjaro XFCE

The promt to “Open With” is not a real problem since after putting “Remember Choice” it’s not appearing anymore.

The problem that’s still bugging me is the opened tab in Firefox after clicking on an URI obsidian internal link.


Thanks for showing me where to change it in Firefox, happy to know it’s a simple thing


Thanks for the help. When you do command palette > Show in Folder, does it also open in your browser, or does it work in your file manager? I think if I solve this I might fix the blank tab issues.

I think you might be missing something, try this:

Yeah something must be missing, thanks for the help

I have my obsidian.desktop file in
~/.local/share/applications

When I run:

xdg-mime default obsidian.destkop x-scheme-handler/obsidian

What I get is:

xdg-mime: malformed argument 'obsidian.destkop', expected *.desktop Try 'xdg-mime --help' for more information.

desktop → destkop is certainly a “malformed argument” for your terminal… :wink:

1 Like

Woops! That was an inherited typo

1 Like

No worries, thanks @alltagsverstand for realizing

I corrected it and it worked

xdg-mime default obsidian.desktop x-scheme-handler/obsidian

after trying

update-desktop-database

I get:

The databases in [/usr/local/share/applications, /usr/share/applications] could not be updated. 

You need sudo for that

1 Like

nice after doing it with sudo it didn’t return an error.

Unfortunatly it didn’t solve the blank tab in firefox, that’s such as strange side effect, not sure what it could be causing it!

Yes, to get URI working with AppImageLauncher wasn’t that hard.

  1. Open your .desktop file. (Mine was in /home/juris/.local/share/applications/).

  2. Find MimeType= and edit to MimeType=x-scheme-handler/obsidian;

  3. Open and edit mimeapps.list (also in /home/juris/.local/share/applications/) with:

       [Default Applications]
       x-scheme-handler/obsidian=appimagekit_8fbd98b6c46b129329185da71d885be3- 
       Obsidian.desktop
    
  4. Be sure that name after x-scheme-handler/obsidian= is the same as .desktop file created by AppImageLauncher inside ~/.local/share/applications

Now URI links should work.

1 Like

4 posts were split to a new topic: Open a specific vault with Obsidian URI

thanks for the tips! appreciate that