diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-29 10:09:29 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-29 10:09:29 +0200 |
| commit | 0e2aefcf01613395e4f3bb966606a2c6ae6e46f9 (patch) | |
| tree | 494650e7b8a2378af47f3da4b8ee41e9566cbe10 /bin/udt-palette | |
| parent | 1e4d2b4be7ad20dd108503fb65c264673ca6457b (diff) | |
| download | unified-desktop-theme-0e2aefcf01613395e4f3bb966606a2c6ae6e46f9.tar.gz unified-desktop-theme-0e2aefcf01613395e4f3bb966606a2c6ae6e46f9.zip | |
feat(grub): render grub-theme-udt's theme.txt and print its root install
theme.txt has no include, so udt-palette substitutes eight roles and the
scheme name into the sibling repo's theme.txt.in, conky-style. The accent is
the scheme's fixed one; nothing at boot can read the wallpaper.
install.sh runs that repo's build as the user and, only when it succeeds,
prints the root copy into /boot/grub/themes plus the one-time GRUB_THEME and
grub-mkconfig steps. External targets are now skipped whenever their template
is missing, not only when the repo is, so a sibling mid-setup cannot break an
install.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'bin/udt-palette')
| -rwxr-xr-x | bin/udt-palette | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/bin/udt-palette b/bin/udt-palette index 6a15a52..00e3092 100755 --- a/bin/udt-palette +++ b/bin/udt-palette @@ -30,6 +30,7 @@ SELECTOR_SEED = PALETTE_DIR / "roles.conf.default" # The Lua dashboard lives in its own repo; UDT only renders its colours. # A sibling checkout, like waybar-theme-udt; skipped when it is not cloned. CONKY_REPO = REPO.parent / "conky-theme-udt" +GRUB_REPO = REPO.parent / "grub-theme-udt" def parse_conf(path): @@ -688,6 +689,20 @@ def gen_conky(res, scheme, palette, template): return out +def gen_grub(res, scheme, palette, template): + """GRUB: substitute into the theme template in the grub-theme-udt repo. + + theme.txt has no include, so the colours are baked in. The accent is the + scheme's fixed one: nothing at boot can read the wallpaper. The PNG slices + that carry colour are drawn by that repo's build script from this output. + """ + out = template.replace("@SCHEME@", scheme) + for role in ("bg", "bg_alt", "bg_deep", "surface", "fg", "fg_dim", + "fg_faint", "accent"): + out = out.replace(f"@{role.upper()}@", hex6(res[role])) + return out + + def gen_accent_py(res, scheme, palette, snap_names): """The accent table and Macchiato dict udt-accent carries for Firefox. @@ -787,6 +802,7 @@ TARGETS = [ ("templates/hyprlock/hyprlock-palette.conf", gen_hyprlock, None), ("templates/nvim/udt.lua", gen_nvim, None), (str(CONKY_REPO / "conky.conf"), gen_conky, str(CONKY_REPO / "conky.conf.in")), + (str(GRUB_REPO / "theme.txt"), gen_grub, str(GRUB_REPO / "theme.txt.in")), ("bin/udt_colors.py", gen_accent_py, None), ("templates/homepage/custom.css", gen_homepage, None), ("templates/obsidian/udt.css", gen_obsidian, None), @@ -817,9 +833,9 @@ def generate(roles_path, out_dir, scheme=None): scheme, palette, res, snap_names = load(roles_path, scheme=scheme) written = [] for target, fn, template in TARGETS: - # A sibling repo that is not cloned here is not an error: its - # template is missing too, and there is nothing to theme. - if Path(target).is_absolute() and not Path(target).parent.is_dir(): + # A sibling repo that is not cloned here, or has no template yet, is + # not an error: there is nothing to theme. + if Path(target).is_absolute() and not (template and Path(template).exists()): continue # A target outside this repo (the conky dashboard) is an absolute path, # and `out_dir / absolute` discards out_dir entirely. For the real |
