diff options
| -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:" |
