Skip to content

Instantly share code, notes, and snippets.

@Konstantin-Dudersky
Last active October 21, 2022 05:28
Show Gist options
  • Save Konstantin-Dudersky/e626d04e8981efe4fe3b4547154d8f59 to your computer and use it in GitHub Desktop.
Save Konstantin-Dudersky/e626d04e8981efe4fe3b4547154d8f59 to your computer and use it in GitHub Desktop.
Open obsidian vault
#!/usr/bin/python3
"""Open obsidian vault.
Set the path to the vault in a variable VAULT_PATH.
Examples:
- absolute path:
VAULT_PATH: str = "/home/user/path-to-vault"
- relative path - current folder:
VAULT_PATH: str = ""
- relative path - subfolder of the root folder:
VAULT_PATH: str = "../subfolder"
"""
import subprocess
from pathlib import Path
VAULT_PATH: str = ""
URI: str = "obsidian://{path}"
subprocess.run(["xdg-open", URI.format(path=Path(VAULT_PATH).resolve())])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment