aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-11 19:00:56 +0200
committerDanilo M. <danix@danix.xyz>2026-09-11 19:00:56 +0200
commit8b8731e089575a4bf3b9b308e26b38f4dad47511 (patch)
tree1352a78585a7fad550ead5c3455aa91b8bb037fc
parent7b11746f0b6a280169150fc8e18146963a65c55c (diff)
downloadunified-desktop-theme-8b8731e089575a4bf3b9b308e26b38f4dad47511.tar.gz
unified-desktop-theme-8b8731e089575a4bf3b9b308e26b38f4dad47511.zip
fix(appthemes): take Obsidian vaults from its registry, not a directory scanHEADmaster
The installer found vaults by scanning ~/Documents/Obsidian for .obsidian directories, which cannot tell a vault from a leftover. That parent folder holds an abandoned .obsidian from a vault that no longer exists, so the scan found six vaults where Obsidian knows five, and the extra one got a snippet and an edited appearance.json for something Obsidian never opens. It now reads ~/.config/obsidian/obsidian.json, which is the list Obsidian itself maintains, and only writes to a path that is both registered and still has a .obsidian directory. The stray directory has been restored to its previous contents. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015gbjA2bmswN8jyPDKzrvqe
-rwxr-xr-xbin/udt-appthemes26
1 files changed, 20 insertions, 6 deletions
diff --git a/bin/udt-appthemes b/bin/udt-appthemes
index eedc144..37d3e63 100755
--- a/bin/udt-appthemes
+++ b/bin/udt-appthemes
@@ -17,19 +17,33 @@ from pathlib import Path
REPO = Path(__file__).resolve().parent.parent
SNIPPET = "udt"
-VAULT_ROOT = Path.home() / "Documents" / "Obsidian"
+OBSIDIAN_REGISTRY = Path.home() / ".config" / "obsidian" / "obsidian.json"
TYPORA_THEMES = Path.home() / ".config" / "Typora" / "themes"
def vaults():
- """Every Obsidian vault under the vault root.
+ """The vaults Obsidian itself knows about.
- A vault is any directory holding a .obsidian config dir. Nested vaults are
- real: a vault inside another vault's folder is still its own vault.
+ Read from Obsidian's own registry rather than found by scanning for
+ .obsidian directories. A scan cannot tell a vault from an abandoned one:
+ ~/Documents/Obsidian holds a leftover .obsidian from a vault that no longer
+ exists, and writing to it touched config for something Obsidian never
+ opens.
"""
- if not VAULT_ROOT.is_dir():
+ try:
+ data = json.loads(OBSIDIAN_REGISTRY.read_text())
+ except (OSError, json.JSONDecodeError):
return []
- return sorted(p for p in VAULT_ROOT.rglob(".obsidian") if p.is_dir())
+
+ found = []
+ for entry in data.get("vaults", {}).values():
+ path = entry.get("path")
+ if not path:
+ continue
+ config = Path(path) / ".obsidian"
+ if config.is_dir():
+ found.append(config)
+ return sorted(found)
def install_obsidian(source):