Make the wallust border gradient actually track the wallpaper
Browse files at this commit3eb761e5e180df1b6559bacb616a2abdfa7fd59aParent: d068d19- fix
- make the wallust border gradient actually track the wallpaper
4 changed files +36 -10
- .config/niri/config.kdl +16 -1
- .config/scripts/niri/wallust_niri_colors.sh +14 -9
- .config/wallust/templates/niri-colors.sh +5 -0
- .config/wallust/wallust.toml +1 -0
.config/niri/config.kdlmodified+16 -1
| @@ -232,7 +232,7 @@ layout { | |||
| 232 | // colors cannot live in a separate generated file. Keep the marker | 232 | // colors cannot live in a separate generated file. Keep the marker |
| 233 | // comment directly above it, and keep the whole thing on one line. | 233 | // comment directly above it, and keep the whole thing on one line. |
| 234 | // WALLUST-GRADIENT | 234 | // WALLUST-GRADIENT |
| 235 | - active-gradient from="#7B6753" to="#BC7857" angle=90 in="oklch longer hue" | 235 | + active-gradient from="#035233" to="#78818A" angle=90 in="oklch" |
| 236 | 236 | ||
| 237 | // Hyprland col.inactive_border = rgba(595959aa) | 237 | // Hyprland col.inactive_border = rgba(595959aa) |
| 238 | inactive-color "#595959aa" | 238 | inactive-color "#595959aa" |
| @@ -364,6 +364,21 @@ animations { | |||
| 364 | // Find more information on the wiki: | 364 | // Find more information on the wiki: |
| 365 | // https://niri-wm.github.io/niri/Configuration:-Window-Rules | 365 | // https://niri-wm.github.io/niri/Configuration:-Window-Rules |
| 366 | 366 | ||
| 367 | +// Draw the border AROUND windows instead of behind them. By default niri uses | ||
| 368 | +// the border as the window background, which is invisible behind an opaque | ||
| 369 | +// window — so the Hyprland-style border simply never showed up. This is the | ||
| 370 | +// same setting that stopped the gradient bleeding through wezterm's opacity. | ||
| 371 | +window-rule { | ||
| 372 | + draw-border-with-background false | ||
| 373 | + | ||
| 374 | + // GTK4/libadwaita apps (nautilus, ...) round their own corners at ~12px, | ||
| 375 | + // while niri draws the border square — the two did not line up. Telling | ||
| 376 | + // niri the radius makes the border follow the curve, and clip-to-geometry | ||
| 377 | + // trims the window to it so nothing pokes out past the border. | ||
| 378 | + geometry-corner-radius 12 | ||
| 379 | + clip-to-geometry true | ||
| 380 | +} | ||
| 381 | + | ||
| 367 | window-rule { | 382 | window-rule { |
| 368 | // This regular expression is intentionally made as specific as possible, | 383 | // This regular expression is intentionally made as specific as possible, |
| 369 | // since this is the default config, and we want no false positives. | 384 | // since this is the default config, and we want no false positives. |
.config/scripts/niri/wallust_niri_colors.shmodified+14 -9
| @@ -15,19 +15,24 @@ | |||
| 15 | set -euo pipefail | 15 | set -euo pipefail |
| 16 | 16 | ||
| 17 | CONFIG="$HOME/.config/niri/config.kdl" | 17 | CONFIG="$HOME/.config/niri/config.kdl" |
| 18 | -SEQUENCES="$HOME/.cache/wallust/sequences" | 18 | +# Written by the 'niri' entry in wallust.toml [templates] from |
| 19 | +# ~/.config/wallust/templates/niri-colors.sh. Do NOT read | ||
| 20 | +# ~/.cache/wallust/sequences instead: the picker runs `wallust run -qs`, and -s | ||
| 21 | +# skips writing that file, so it silently goes stale and the border never | ||
| 22 | +# changes. | ||
| 23 | +COLORS="$HOME/.cache/wallust/niri-colors.sh" | ||
| 19 | MARKER="// WALLUST-GRADIENT" | 24 | MARKER="// WALLUST-GRADIENT" |
| 20 | 25 | ||
| 21 | [ -f "$CONFIG" ] || exit 0 | 26 | [ -f "$CONFIG" ] || exit 0 |
| 22 | -[ -f "$SEQUENCES" ] || exit 0 | 27 | +[ -f "$COLORS" ] || exit 0 |
| 23 | 28 | ||
| 24 | -# wallust writes the palette as terminal OSC sequences: ]4;<n>;#RRGGBB | 29 | +# shellcheck source=/dev/null |
| 25 | -color_at() { | 30 | +. "$COLORS" |
| 26 | - grep -oP "\]4;$1;#\K[0-9A-Fa-f]{6}" "$SEQUENCES" | head -1 | ||
| 27 | -} | ||
| 28 | 31 | ||
| 29 | -FROM=$(color_at 4) | 32 | +# wallust's {{colorN}} placeholders already carry the leading '#'; strip it so |
| 30 | -TO=$(color_at 6) | 33 | +# exactly one is added back below regardless of format. |
| 34 | +FROM="${NIRI_BORDER_FROM#\#}" | ||
| 35 | +TO="${NIRI_BORDER_TO#\#}" | ||
| 31 | 36 | ||
| 32 | if [ -z "$FROM" ] || [ -z "$TO" ]; then | 37 | if [ -z "$FROM" ] || [ -z "$TO" ]; then |
| 33 | exit 0 | 38 | exit 0 |
| @@ -40,7 +45,7 @@ awk -v marker="$MARKER" -v from="#$FROM" -v to="#$TO" ' | |||
| 40 | hit { | 45 | hit { |
| 41 | match($0, /^[ \t]*/) | 46 | match($0, /^[ \t]*/) |
| 42 | indent = substr($0, 1, RLENGTH) | 47 | indent = substr($0, 1, RLENGTH) |
| 43 | - printf "%sactive-gradient from=\"%s\" to=\"%s\" angle=90 in=\"oklch longer hue\"\n", indent, from, to | 48 | + printf "%sactive-gradient from=\"%s\" to=\"%s\" angle=90 in=\"oklch\"\n", indent, from, to |
| 44 | hit = 0 | 49 | hit = 0 |
| 45 | next | 50 | next |
| 46 | } | 51 | } |
.config/wallust/templates/niri-colors.shadded+5 -0
| @@ -0,0 +1,5 @@ | |||
| 1 | +# Generated by wallust — consumed by ~/.config/scripts/niri/wallust_niri_colors.sh | ||
| 2 | +# Do not read ~/.cache/wallust/sequences instead: the wallpaper picker runs | ||
| 3 | +# `wallust run -qs`, and -s skips writing that file, so it goes stale. | ||
| 4 | +NIRI_BORDER_FROM="{{color4}}" | ||
| 5 | +NIRI_BORDER_TO="{{color6}}" | ||
.config/wallust/wallust.tomlmodified+1 -0
| @@ -56,6 +56,7 @@ gtk2 = { template = 'gtk2.gtkrc', target = '~/.gtkrc-2.0.mine' } | |||
| 56 | kdeglobals = { template = 'kdeglobals', target = '~/.config/kdeglobals' } | 56 | kdeglobals = { template = 'kdeglobals', target = '~/.config/kdeglobals' } |
| 57 | qt5ct = { template = 'qt5ct-wallust.conf', target = '~/.config/qt5ct/colors/wallust.conf' } | 57 | qt5ct = { template = 'qt5ct-wallust.conf', target = '~/.config/qt5ct/colors/wallust.conf' } |
| 58 | qt6ct = { template = 'qt6ct-wallust.conf', target = '~/.config/qt6ct/colors/wallust.conf' } | 58 | qt6ct = { template = 'qt6ct-wallust.conf', target = '~/.config/qt6ct/colors/wallust.conf' } |
| 59 | +niri = { template = 'niri-colors.sh', target = '~/.cache/wallust/niri-colors.sh' } | ||
| 59 | [hooks] | 60 | [hooks] |
| 60 | # Resolve mix() and compute surface colors for GTK and QT | 61 | # Resolve mix() and compute surface colors for GTK and QT |
| 61 | theme_colors = """~/.config/scripts/shared/theme_colors.sh""" | 62 | theme_colors = """~/.config/scripts/shared/theme_colors.sh""" |