Option: Open Last Used Vault or Open Vault Selector

Instead of pick vault on start-up, on could implement this as a long-click on the obsidian icon. A pop-up could show all available vaults and one could choose before even opening the app: [Feature] App shortcuts/3D touch - #2 by Gnuelp

If there were a commandline option under windows we could have several icons, one for each vault. At least on windows it seems to be quite simple. Unfortunately I was not able to find such a possibility.

You can use several icons to do this.

Use case or problem

Opening Obsidian opens that last vault when really I want a different vault. This wastes time as sometimes vaults take a bit of time opening up and then require me to go to the vault picker myself.

Proposed solution

Allow a setting that gives the user the choice between:

  • Open the last vault
  • Open the Vault switcher

Current workaround (optional)

  • Wait until Obsidian opens the last vault (sometimes it’s more than one) and many plugins can cause some vaults to open very slowly
  • Open the vault switcher manually
  • Open the new vault
  • Close to other vault that was opened

Related feature requests (optional)

I noticed that the feature I was looking for (and opening a request for) has been requested multiple times already (e.g. this post and [this post]( Option: Open Last Used Vault or Open Vault Selector - Feature archive - Obsidian Forum)). And they all point to an existing topic: Pick vault on app lauch.

However, that topic seems to have been deleted. If the feature request already exist, I would appreciate a link to it. If not, then I would like to officially request it.

1 Like

I’m also using Git Bash on my Windows, so I’ve created a workaround script that modifies Obsidian’s obsidian.json file and changes all "open":true values to "open":false before launching Obsidian. That way my Obsidian always launches with the vault selector instead of reopening the last vault. The only downside to this is every time I launch Obsidian, a terminal window shows up for a moment, but it’s just a minor inconvenience to get a very convenient feature.

I’ve figured it might also be helpful to see if I could do it with Windows PowerShell, so people could use this even if they don’t have Git Bash on their systems. Here’s how I’ve set up both versions:

Git Bash version

  1. Create a script file wherever it is convenient for you. Call it something like Obsidian.sh.
  2. Edit the script and put this code in:
sed -i 's/\"open\":true/\"open\":false/g' /c/Users/YourWindowsUserName/AppData/Roaming/obsidian/obsidian.json
start obsidian:

Just remember to replace “YourWindowsUserName” with your actual user name.

  1. Right-click on the script file and click “Create shortcut”.
  2. Put the shortcut file where you want it. You can also pin it to your taskbar or start menu by right-clicking and selecting appropriate option.
  3. Change the name of the shortcut. If you want, you can also change the icon to match Obsidians by right-clicking the shortcut, going into Properties, clicking the “Change Icon…” button and putting %USERPROFILE%\AppData\Local\Obsidian\Obsidian.exe as the icon location.

Windows PowerShell version

  1. Create a script file wherever it is convenient for you. Call it something like Obsidian.ps1.
  2. Edit the script file and put this code in:
$filePath = "c:\Users\YourWindowsUserName\AppData\Roaming\obsidian\obsidian.json"
(Get-Content $filePath).Replace("`"open`":true","`"open`":false") | Set-Content $filePath
start obsidian:

Just remember to replace “YourWindowsUserName” with your actual user name.

  1. Right-click on the script file and click “Create shortcut”.
  2. Right-click on the shortcut and go into “Properties”.
  3. In the “Target:” field, before your scripts location, put this in:
powershell -noLogo -ExecutionPolicy unrestricted -file 

So your final target should look something like this:

powershell -noLogo -ExecutionPolicy unrestricted -file C:\Obsidian.ps1
  1. Put the shortcut file where you want it. You can also pin it to your taskbar or start menu by right-clicking and selecting appropriate option.
  2. Change the name of the shortcut. If you want, you can also change the icon to match Obsidians by right-clicking the shortcut, going into Properties, clicking the “Change Icon…” button and putting %USERPROFILE%\AppData\Local\Obsidian\Obsidian.exe as the icon location.
7 Likes

This is a great interim solution, thank you!

After the latest update Obsidian has stopped to open the last used vault and now it asks me to choose a vault on every start. Is it supposed to work like this?

Maybe it’s a good idea to have a toggle between open the last vault and open vault switcher.

Hello everyone, A newbie here… I dont know how to back to the vault I first created. Everytime I open obsidian, it shows .the last opened/ latest vault as a default vault.
Can someone help?

@toxicology007, look for the “open another vault” icon on the bottom left of your window

I don’t think this has been mentioned yet, but I’ve noticed that for me at least, Obsidian reopens whichever window was the last to close when it was last quit, and the vault selector counts as one of those windows.

So, for me at least, if the last window to close was a vault, that is the vault that will open when I launch Obsidian again. But if I instead open the vault selector first, close my vault, then close the vault selector, then the vault selector is what will open when I relaunch Obsidian.

What I personally do is keep the vault selector open in the background before I start working. When it comes time to quit, I close my vault window first, revealing the vault selector in the background, which I close second.

I don’t think this workaround has been mentioned yet, so I hope this will work for others too!

5 Likes

continued from above

If anyone is searching for a workaround that minimizes loading times and doesn’t involve complex scripts, I would recommend trying this. For me, this is not a significant disruption to my workflow.

I would also like to suggest that there be a third choice be added to any setting for “default action on launch” for flexibility:

  • “Continue where you left off” (current behaviour)
  • “Open the vault selector”
  • “Open a specific vault or set of vaults”

where choosing the third option would then reveal a sub-menu with checkboxes next to all the vaults Obsidian is aware of. When Obsidian is launched, all vaults that are checked would open at once.

While this option may not be used as extensively as the other two, I’m generally in favour of having the extra options if there’s no good reason not to have them, and that seems to be the case here.

3 Likes

yeah now i can start obsidian and then choose the vault, allow people to work with multi vaults.

thanks

SO I am also trying to imporve my workflow as I am constantly switching between two vault. Almost had it down after a few issues.
First, the URL won’t pin to the task bar. To make it pin, you can’t just have the uri, you need to put your obsisian link first. eg C:\Users\johnw\AppData\Local\Obsidian\Obsidian.exe obsidian://open/?vault=JB’s%20Obsidian%20Vault

Anyway, I have two sexy icons pinned to my tray, but both instances of obsidian are running from the same shortcut which is a win 11 thing that bugs me. anyway… I did some research and now I have to do some other jobs… Not sure the point of this post…

So my solution is that I have 3 shortcuts pinned to my taskbar. The default obsidian one. I open this first, and so it gets stuck with the multiple instances of the vaults. Then I have two more shortcuts which I tweaked the colour of, and these open the corresponding vault. I think this will work for me. It was really driving me nuts! Image attached.
Obsidian shortcuts

Hi there, do you mind posting a more detailed process of how you were able to achieve that? I don’t understand where to put the obsidian and the URI link. I tried and it reported errors. I also don’t know how to change the icon and how to pin it (I saw nowhere to change the icon, and I couldn’t pin the shortcut to the taskbar either). Would really appreciate your help. Thank you!

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!

3 Likes

Use case or problem

Upon opening Obsidian, prompt to select the notebook to be opened instead of opening the last closed notebook.

Proposed solution

A possible way to implement this could be a small toggle button, which enables or disables this feature, in case users do not want this behaviour by default.

Is that feature still available?

Like many others have mentioned, it would be very useful to have the option for Obsidian to be able to just show the vault selector at startup. I have multiple vaults and the logic of Obsidian opening whichever vault I was in last isn’t very appealing. It would be preferable to be able to (optionally if necessary) have Obisidian just show the vault selector on startup.

1 Like

Adding to this: I don’t understand why we need to use shortcuts and URL hacks to do this, a setting would do the trick just fine. I feel like the average user can get lost scrolling through forum posts and trying out every solution they come across, and this topic has sparked many duplicate posts already, it clearly seems to be a feature a lot of users would like.
My proposed solution is the following:
A setting called “Startup view” or “Initial Display Preference”, preferably in the “General” section. The setting features a dropdown, via which either “Last Open Vault” or “Vault Selector” can be chosen. As a setting description, maybe something like “Select what window to show when opening Obsidian.” would work.

2 Likes