Opening Specific Vault Directly From Desktop
Hi, I have a solution but It’s for Linux and GNOME desktop environment (If you are using different desktop environment you can read this try something similar). Please first read carefully before following instructions, and it’s very easy, maybe my explanation made it complicated so i have also added images so that you can understand it easily . It will work for obsidian downloaded from flatpak and from AppImage. Others i don’t know, it might work.
When i right click obsidian before it looks like this:
After:
I have added two options (Computer Vault and Extra Vault) which opens different Vault.
Editing Desktop Files:
To add those options you need to edit desktop files. See here for details on GNOME desktop file
If you have downloaded obsidian from flatpak
using Fedora Software Application, it creates .desktop
automatically. If it didn’t create .desktop
file you can create it easily by reading this article. If you download obsidian using AppImage, see here to create desktop file for Obsidian AppImage (Even if you are not using AppImage you can read this to know more about desktop file, Its a simple easy to understand article) and after you have created desktop file you can continue following instructions.
You can find the desktop file for obsidian from terminal with following command:
$ locate md.obsidian.Obsidian.desktop
# Output
/var/lib/flatpak/app/md.obsidian.Obsidian/x86_64/stable/a026ee6e3a2f2b8cad63c7ea3e6e94b6dc9f1a0be103220a2b01cace258cb425/export/share/applications/md.obsidian.Obsidian.desktop
/var/lib/flatpak/app/md.obsidian.Obsidian/x86_64/stable/a026ee6e3a2f2b8cad63c7ea3e6e94b6dc9f1a0be103220a2b01cace258cb425/files/share/applications/md.obsidian.Obsidian.desktop
/var/lib/flatpak/exports/share/applications/md.obsidian.Obsidian.desktop
Since i installed obsidian from flatpak it creates md.obsidian.Obsidian.desktop
, if you installed using AppImage and created custom obsidian.desktop
file, we will update that file
In my case we will update md.obsidian.Obsidian.desktop
file. It look like following (if you have created custom desktop file it will look similar to this, some details may be missing):
[Desktop Entry]
Name=Obsidian
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u %U @@
Terminal=false
Type=Application
Icon=md.obsidian.Obsidian
StartupWMClass=obsidian
Comment=Obsidian
MimeType=x-scheme-handler/obsidian;
Categories=Office;
X-Flatpak-Tags=proprietary;
X-Flatpak=md.obsidian.Obsidian
Adding options:
I have two obsidian vaults and you can see their names below (extra_vault and computer_science):
To add options we need to add [Desktop Action]
in same .desktop
file with one new line below the last entry. I am adding three actions, one for new window and other two for opening different vaults and it looks like this:
[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u %U @@
[Desktop Action computer-vault]
Name=Computer Vault
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u obsidian://open?vault=computer_science @@
[Desktop Action extra-vault]
Name=Extra Vault
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u obsidian://open?vault=extra_vault @@
[Desktop Action new-window]
: for new-window option. new-window
is just a idendifier name, you can name it anything, cause we will later tell about it in [Desktop Entry]
Name=New Window
: is Display name
Exec=/usr/...
: Same as [Desktop Entry]
→ [Exec]
value (don’t copy mine, you can copy from your own [Desktop Entry]
)
But for other two options you need to modify their Name
as you want and to open the vault you want you need to specify it in %U
section in Exec
As you can see for new-window
,
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u %U @@
%U
is as it is.
But in computer-vault
:
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u obsidian://open?vault=computer_science @@
%U
= obsidian://open?vault=computer_science
vault=(vault name, and in my case vault name is ‘computer_science’ )
But in extra-vault
:
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u obsidian://open?vault=extra_vault @@
%U
= obsidian://open?vault=extra_vault
vault=(vault name)
Now we need to mention these desktop actions in [Desktop Entry]
. We can do so by adding following line before all these desktop actions
:
Actions=new-window;computer-vault;extra-vault;
(dont forget semicolon at end)
In my case i added this line below X-Flatpak=md.obsidian.Obsidian
line.
In actions you mentions all those Desktop Action
identifier name.
And here’s what my complete md.obsidian.Obsidian.desktop
file looks like:
[Desktop Entry]
Name=Obsidian
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u %U @@
Terminal=false
Type=Application
Icon=md.obsidian.Obsidian
StartupWMClass=obsidian
Comment=Obsidian
MimeType=x-scheme-handler/obsidian;
Categories=Office;
X-Flatpak-Tags=proprietary;
X-Flatpak=md.obsidian.Obsidian
Actions=new-window;computer-vault;extra-vault;
[Desktop Action new-window]
Name=New Window
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u %U @@
[Desktop Action computer-vault]
Name=Computer Vault
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u obsidian://open?vault=computer_science @@
[Desktop Action extra-vault]
Name=Extra Vault
Exec=/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=obsidian.sh --file-forwarding md.obsidian.Obsidian @@u obsidian://open?vault=extra_vault @@
You might ask why i have also added new-window
option. It’s because if you don’t have any options/actions a default new-window
option is created but if you are manually adding options it won’t create default new-window
option so we have to manually add it too.
I don’t know much about desktop files. I just did some comparison with firefox.desktop
and obsidian desktop file, read some article on GNOME desktop file, learned from this article on Obsidian URI and AppImage) and did some experimentation and at last got these result. I lost lots of time while trying to solve this problem, and I hope you won’t have to and this solution will work for you. Thank You!