aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/udt-palette13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/udt-palette b/bin/udt-palette
index bee7dc5..a9aa005 100755
--- a/bin/udt-palette
+++ b/bin/udt-palette
@@ -725,6 +725,19 @@ def selftest():
assert not missing, f"{scheme} is missing roles: {sorted(missing)}"
assert not extra, f"{scheme} has roles no other scheme has: {sorted(extra)}"
+ # Every placeholder in the GTK templates must correspond to a role, or it
+ # renders literally and GTK drops the declaration without an error. The
+ # stylesheets are too large to eyeball, so this is the only thing standing
+ # between a typo and a silently half-themed desktop.
+ gtk_dir = REPO / "templates" / "gtk"
+ known = {f"@{r.upper()}@" for r in GTK_ROLES}
+ known |= {f"@{r.upper()}_RGB@" for r in GTK_ROLES}
+ known.add("@MAUVE@")
+ for tpl in sorted(gtk_dir.glob("*.in")) + sorted((gtk_dir / "assets").glob("*.in")):
+ used = set(re.findall(r"@[A-Z][A-Z_]*@", tpl.read_text()))
+ unknown = used - known
+ assert not unknown, f"{tpl.name} uses unknown placeholders: {sorted(unknown)}"
+
# Every name the rofi themes reference must be emitted, or rofi refuses to
# parse the theme and every launcher on the desktop stops opening. This is
# a real regression that shipped: gen_rofi used to emit the scheme's own