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 | |
| 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>
| -rw-r--r-- | AGENTS.md | 4 | ||||
| -rwxr-xr-x | bin/udt-palette | 22 | ||||
| -rwxr-xr-x | install.sh | 18 |
3 files changed, 41 insertions, 3 deletions
@@ -23,6 +23,10 @@ Sibling checkouts are wired from here, each skipped when not cloned: `waybar-theme-udt` (its own `install.sh`), `conky-theme-udt` (five links into `~/.config/conky/`) and `hypr-theme`, which is the whole of `~/.config/hypr` as one symlink. A real `~/.config/hypr` directory is left alone with a warning. +`grub-theme-udt` is SDDM's shape: udt-palette renders its `theme.txt.in`, +`install.sh` runs its `build` as the user, then prints the root copy. A copy, +not a link, because GRUB reads `/boot` before `/home` is mounted; it needs +rerunning after a scheme or wallpaper change. Live files that mix theme keys with anything else are merged, never replaced: `install.sh`'s `ini_merge` writes every key in `templates/qt-gtk/qt5ct.conf`, 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 @@ -339,6 +339,24 @@ if [ -d "$sddm_repo/theme" ]; then echo " printf '[Theme]\\nCurrent=udt\\n' > /etc/sddm.conf.d/udt.conf" fi +# GRUB. Same shape as SDDM: udt-palette has rendered theme.txt, the sibling +# repo's build assembles the theme as the user, and the root half is printed. +# A copy, not a link: GRUB reads /boot before /home is mounted. The background +# is a snapshot of the wallpaper, so the copy needs rerunning after a scheme +# or wallpaper change; grub-mkconfig only when GRUB_THEME changes. +grub_repo="$(realpath -m "$repo/../grub-theme-udt")" +if [ -x "$grub_repo/build" ]; then + if "$grub_repo/build"; then + echo + echo "grub theme: run these as root to install or refresh it" + echo " rm -rf /boot/grub/themes/udt && cp -r \"$grub_repo/build/udt\" /boot/grub/themes/" + echo " # once: GRUB_THEME=\"/boot/grub/themes/udt/theme.txt\" in /etc/default/grub, then" + echo " grub-mkconfig -o /boot/grub/grub.cfg" + else + echo "grub: its build failed, theme not refreshed" >&2 + fi +fi + [ -n "$reloaded" ] && echo "reloaded:$reloaded" echo "installed:" |
