diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-19 16:42:07 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-19 16:42:07 +0200 |
| commit | a25905dfaeceff258b482007e8b6eb9f9a6d7063 (patch) | |
| tree | 0cd17519482c816a97e9a2e780fef1d3e0801942 /bin/udt-accent | |
| parent | 63fd47668a66ff546e330d22b64b7ce6e184a404 (diff) | |
| download | unified-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/udt-accent')
| -rwxr-xr-x | bin/udt-accent | 35 |
1 files changed, 35 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 |
