aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-19 16:42:07 +0200
committerDanilo M. <danix@danix.xyz>2026-09-19 16:42:07 +0200
commita25905dfaeceff258b482007e8b6eb9f9a6d7063 (patch)
tree0cd17519482c816a97e9a2e780fef1d3e0801942 /bin
parent63fd47668a66ff546e330d22b64b7ce6e184a404 (diff)
downloadunified-desktop-theme-a25905dfaeceff258b482007e8b6eb9f9a6d7063.tar.gz
unified-desktop-theme-a25905dfaeceff258b482007e8b6eb9f9a6d7063.zip
feat: theme hyprlock from the UDT palette and accent
udt-palette renders the scheme-level palette to templates/hyprlock/hyprlock-palette.conf ($panel, $input_bg, $text, $subtext, $fail); udt-accent writes the wallpaper accent gradient to ~/.cache/udt/hyprlock-border.conf as a hyprlang variable. The hyprlock config sources both, so a scheme switch recolours the lock and a wallpaper change recolours its border. install.sh copies the palette and seeds the border from the committed fallback on a fresh cache. Both selftests cover the new outputs.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/udt-accent35
-rwxr-xr-xbin/udt-palette42
2 files changed, 77 insertions, 0 deletions
diff --git a/bin/udt-accent b/bin/udt-accent
index a862ae9..6462aae 100755
--- a/bin/udt-accent
+++ b/bin/udt-accent
@@ -34,6 +34,9 @@ MIN_CHROMA = 10.0
CACHE = Path.home() / ".cache" / "udt"
OUTPUT = CACHE / "udt-accent.rasi"
BORDER_OUTPUT = CACHE / "udt-border.lua"
+# hyprlock cannot read the Lua border table, so the same three hues are also
+# written as a hyprlang variable the lock config sources. See write_hyprlock.
+HYPRLOCK_BORDER_OUTPUT = CACHE / "hyprlock-border.conf"
SUBLIME = (Path.home() / ".config" / "sublime-text" / "Packages" / "User"
/ "udt.sublime-color-scheme")
QML_OUTPUT = CACHE / "udt-palette.qml"
@@ -208,6 +211,28 @@ def write_border(name):
write_atomic(BORDER_OUTPUT, content)
+def hyprlock_border_content(name):
+ """The hyprlock border gradient, as a hyprlang variable assignment.
+
+ The lock panel, its avatar ring and the password outline all take this
+ gradient: the same three hues the Hyprland window border rotates through,
+ so a wallpaper change recolours the lock with the rest of the desktop.
+ One `rgb(hex) rgb(hex) rgb(hex) <angle>` line, which is the syntax the
+ input-field already used before it followed the theme.
+ """
+ before, after = hue_neighbours(name)
+ stops = " ".join(f"rgb({ACCENTS[n].lstrip('#')})" for n in (before, name, after))
+ return (
+ "# Generated by udt-accent. Do not edit.\n"
+ f"$border = {stops} 45deg\n"
+ )
+
+
+def write_hyprlock_border(name):
+ """Write the hyprlock border gradient, atomically."""
+ write_atomic(HYPRLOCK_BORDER_OUTPUT, hyprlock_border_content(name))
+
+
def read_palette():
"""Parse palette.rasi into {name: "#rrggbb"}.
@@ -429,6 +454,7 @@ def main(image):
write_accent(name)
write_border(name)
+ write_hyprlock_border(name)
write_qml(name)
write_sublime(name)
write_sddm(name, image)
@@ -485,6 +511,15 @@ def selftest():
delta = abs(_hue(ACCENTS[neighbour]) - _hue(ACCENTS[name]))
assert min(delta, 2 * math.pi - delta) < math.pi, (name, neighbour)
+ # The lock border carries the same three hues as the window border, in
+ # hyprlang gradient syntax: three rgb() stops and an angle. Get it wrong and
+ # the panel border, avatar ring and password outline all draw hyprlock's
+ # default cyan instead of the accent.
+ lock = hyprlock_border_content(FALLBACK)
+ assert lock.count("rgb(") == 3, lock
+ assert lock.rstrip().endswith("45deg"), lock
+ assert "$border = " in lock, lock
+
# The SDDM theme reads this file through a symlink, so it has to carry every
# key the theme asks for. The names are spelled out here rather than read
# from SDDM_KEYS: deriving both the input and the check from the same
diff --git a/bin/udt-palette b/bin/udt-palette
index 9bd3838..fbe53e6 100755
--- a/bin/udt-palette
+++ b/bin/udt-palette
@@ -260,6 +260,39 @@ def gen_kitty(res, scheme, palette):
return "\n".join(lines) + "\n"
+def gen_hyprlock(res, scheme, palette):
+ """hyprlock: the lock screen's scheme-level palette, as hyprlang variables.
+
+ Only the values that move with the scheme. The accent border is a separate
+ generated file, written by udt-accent, because it follows the wallpaper
+ rather than the scheme; hyprlock.conf sources both.
+
+ The panel alpha is a design constant, not a role: it matches the drawer's
+ Qt.alpha(Theme.base, 0.72), so the lock panel and the drawer read as one
+ surface.
+ """
+ def with_alpha(role, alpha):
+ r, g, b, _ = res[role]
+ return f"rgba({r},{g},{b},{alpha})"
+
+ rows = [
+ ("panel", with_alpha("bg", 0.72)),
+ ("input_bg", rgba(res["surface"])),
+ ("text", rgba(res["fg"])),
+ ("subtext", rgba(res["fg_dim"])),
+ ("fail", rgba(res["critical"])),
+ ]
+ body = "\n".join(f"${name} = {value}" for name, value in rows)
+
+ return (
+ f"# {BANNER.format(scheme=scheme)}\n"
+ "#\n"
+ "# hyprlock's static palette. The accent border is generated separately\n"
+ "# by udt-accent, at ~/.cache/udt/hyprlock-border.conf.\n"
+ f"{body}\n"
+ )
+
+
def gen_obsidian(res, scheme, palette):
"""Obsidian: a CSS snippet overriding the theme variables.
@@ -659,6 +692,7 @@ TARGETS = [
("rofi/udt/palette.rasi", gen_rofi, None),
("templates/waybar/theme.css", gen_waybar, None),
("templates/terminal/kitty-theme.conf", gen_kitty, None),
+ ("templates/hyprlock/hyprlock-palette.conf", gen_hyprlock, None),
(str(CONKY_REPO / "conky.conf"), gen_conky, str(CONKY_REPO / "conky.conf.in")),
("bin/udt_colors.py", gen_accent_py, None),
("templates/homepage/custom.css", gen_homepage, None),
@@ -782,6 +816,14 @@ 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)}"
+ # The hyprlock palette must name every variable the lock config references.
+ # A missing one renders a literal `$var`, and hyprlock then falls back to a
+ # default colour with nothing to say so.
+ _, _, res, _ = load(None, scheme=names[0])
+ lock = gen_hyprlock(res, names[0], None)
+ for var in ("panel", "input_bg", "text", "subtext", "fail"):
+ assert f"${var} = " in lock, f"hyprlock palette is missing ${var}"
+
# 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