aboutsummaryrefslogtreecommitdiffstats
path: root/bin/udt-appthemes
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-29 12:29:38 +0200
committerDanilo M. <danix@danix.xyz>2026-09-29 12:29:38 +0200
commit0ca89376ea0a04ad88ae80b9b602033f3beb8eb6 (patch)
tree1c20a959647fb31689e97b343f1cabd11084c3ce /bin/udt-appthemes
parent5b133dbd86aaf54b0c728128f304c8dd8ebea9d1 (diff)
downloadunified-desktop-theme-0ca89376ea0a04ad88ae80b9b602033f3beb8eb6.tar.gz
unified-desktop-theme-0ca89376ea0a04ad88ae80b9b602033f3beb8eb6.zip
feat(palette): theme btop, Joplin and Feishin
btop gets a generated udt.theme and only the color_theme line of btop.conf is rewritten. Joplin gets userchrome.css overriding the --joplin-* custom properties most of its UI is built on, with !important since Joplin's own :root block is injected later; a userchrome.css udt did not write is left alone. Feishin 1.17 watches a Themes folder for JSON themes, so UDT.json extends its built-in Catppuccin Mocha with the scheme's roles and reaches a running Feishin live once selected. All three use existing roles, so no scheme file changes. udt-appthemes installs them next to Obsidian and Typora; the recap hint names btop and Joplin among the apps that need a restart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'bin/udt-appthemes')
-rwxr-xr-xbin/udt-appthemes67
1 files changed, 66 insertions, 1 deletions
diff --git a/bin/udt-appthemes b/bin/udt-appthemes
index 37d3e63..5504427 100755
--- a/bin/udt-appthemes
+++ b/bin/udt-appthemes
@@ -2,7 +2,8 @@
# udt-appthemes: install the generated app themes that need more than a copy.
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
# Licensed under the GNU General Public License v2 only.
-"""Install the Obsidian snippet into every vault, and the Typora theme.
+"""Install the app themes that need more than a copy: Obsidian, Typora,
+btop, Joplin and Feishin.
Separate from install.sh because enabling an Obsidian snippet means editing
JSON that the user also owns: appearance.json lists every enabled snippet, so
@@ -19,6 +20,9 @@ REPO = Path(__file__).resolve().parent.parent
SNIPPET = "udt"
OBSIDIAN_REGISTRY = Path.home() / ".config" / "obsidian" / "obsidian.json"
TYPORA_THEMES = Path.home() / ".config" / "Typora" / "themes"
+BTOP = Path.home() / ".config" / "btop"
+JOPLIN = Path.home() / ".config" / "joplin-desktop"
+FEISHIN = Path.home() / ".config" / "feishin"
def vaults():
@@ -80,6 +84,54 @@ def install_typora(source):
return True
+def install_btop(source):
+ """Install the theme and point btop.conf's color_theme at it.
+
+ Only that one line is rewritten: btop.conf is btop's own, and it writes
+ the file back on exit, so a btop left running across a scheme switch
+ restores its old color_theme. Restart it after installing.
+ """
+ if not BTOP.is_dir():
+ return False
+ (BTOP / "themes").mkdir(exist_ok=True)
+ shutil.copyfile(source, BTOP / "themes" / "udt.theme")
+ conf = BTOP / "btop.conf"
+ try:
+ lines = conf.read_text().splitlines()
+ except OSError:
+ lines = []
+ want = 'color_theme = "udt"'
+ lines = [want if line.startswith("color_theme") else line for line in lines]
+ if want not in lines:
+ lines.append(want)
+ conf.write_text("\n".join(lines) + "\n")
+ return True
+
+
+def install_joplin(source):
+ """Write userchrome.css, unless the user already keeps their own there.
+
+ Joplin has one userchrome.css per profile and no include, so a file this
+ script did not write is left alone rather than replaced.
+ """
+ if not JOPLIN.is_dir():
+ return None
+ dest = JOPLIN / "userchrome.css"
+ if dest.exists() and "Generated by udt-palette" not in dest.read_text():
+ return False
+ shutil.copyfile(source, dest)
+ return True
+
+
+def install_feishin(source):
+ """Drop the theme into Feishin's Themes folder, which it watches live."""
+ if not FEISHIN.is_dir():
+ return False
+ (FEISHIN / "Themes").mkdir(exist_ok=True)
+ shutil.copyfile(source, FEISHIN / "Themes" / "UDT.json")
+ return True
+
+
def main():
obsidian = REPO / "templates" / "obsidian" / "udt.css"
typora = REPO / "templates" / "typora" / "udt.css"
@@ -95,6 +147,19 @@ def main():
if install_typora(typora):
print("typora: udt.css installed (select it in Themes)")
+ templates = REPO / "templates"
+ if install_btop(templates / "btop" / "udt.theme"):
+ print("btop: udt theme set (restart btop)")
+
+ joplin = install_joplin(templates / "joplin" / "userchrome.css")
+ if joplin:
+ print("joplin: userchrome.css installed (restart Joplin)")
+ elif joplin is False:
+ print("joplin: userchrome.css is your own, left alone")
+
+ if install_feishin(templates / "feishin" / "UDT.json"):
+ print("feishin: UDT theme installed (select it once in Settings, it then follows live)")
+
return 0