Currently, I'm trying to figure out how to open Obsidian Notes vaults from the File Explorer itself (instead of first opening up Obsidian and using the Vault browser).
To that end, the following command works (I'm using the Obsidian notes Appimage, which I prefer to a package style install):
#!/bin/bash
/home/username/Desktop/Obsidian-1.5.11.AppImage "obsidian://open?vault=testvault"
(the name of the vault, and hence the vault folder, is testvault)
I put the command in a .sh file which I saved within the vault folder itself.
I then open a terminal at the vault folder (opening a terminal is necessary, since when the script is run with a double click, the command doesn't work as intended, it doesn't open the indicated vault but merely the last opened vault), and then run the .sh file.
./openvault.sh
Now what I'd like to do is automatically close the terminal after the vault opened, without closing the Obsidian Notes app too.
To that end, I tried the following:
#!/bin/bash
/home/username/Desktop/Obsidian-1.5.11.AppImage "obsidian://open?vault=testvault" & disown && exit
# `&&` after `disown` so that `exit` only gets executed after disown is successfully executed
Now this only partially worked. In that it managed to execute the disown command. So that when I close the terminal with the close button of the terminal app, Obsidian Notes keeps running.
But the exit command doesn't execute. How to make that execute too?
Here's the terminal log of when the command is run:
2024-03-22 09:26:20 Loading main app package /tmp/.mount_Obsidi8hbnvd/resources/obsidian.asar
xdg-settings: default-url-scheme-handler not implemented for xfce
Received callback URL obsidian://open?vault=tesvault
2024-03-22 09:26:21 Checking for update using Github
2024-03-22 09:26:21 Success.
2024-03-22 09:26:21 Latest version is 1.5.11
2024-03-22 09:26:21 App is up to date.
The cursor just keeps blinking under the last line of the log, instead of the terminal returning to the username@machinename:/current/working/directory$ prompt.