diff --git a/.config/niri/config.kdl b/.config/niri/config.kdl index 0093bb4..9584bed 100644 --- a/.config/niri/config.kdl +++ b/.config/niri/config.kdl @@ -232,7 +232,7 @@ layout { // colors cannot live in a separate generated file. Keep the marker // comment directly above it, and keep the whole thing on one line. // WALLUST-GRADIENT - active-gradient from="#7B6753" to="#BC7857" angle=90 in="oklch longer hue" + active-gradient from="#035233" to="#78818A" angle=90 in="oklch" // Hyprland col.inactive_border = rgba(595959aa) inactive-color "#595959aa" @@ -364,6 +364,21 @@ animations { // Find more information on the wiki: // https://niri-wm.github.io/niri/Configuration:-Window-Rules +// Draw the border AROUND windows instead of behind them. By default niri uses +// the border as the window background, which is invisible behind an opaque +// window — so the Hyprland-style border simply never showed up. This is the +// same setting that stopped the gradient bleeding through wezterm's opacity. +window-rule { + draw-border-with-background false + + // GTK4/libadwaita apps (nautilus, ...) round their own corners at ~12px, + // while niri draws the border square — the two did not line up. Telling + // niri the radius makes the border follow the curve, and clip-to-geometry + // trims the window to it so nothing pokes out past the border. + geometry-corner-radius 12 + clip-to-geometry true +} + window-rule { // This regular expression is intentionally made as specific as possible, // since this is the default config, and we want no false positives. diff --git a/.config/scripts/niri/wallust_niri_colors.sh b/.config/scripts/niri/wallust_niri_colors.sh index 13d097f..ffba35c 100755 --- a/.config/scripts/niri/wallust_niri_colors.sh +++ b/.config/scripts/niri/wallust_niri_colors.sh @@ -15,19 +15,24 @@ set -euo pipefail CONFIG="$HOME/.config/niri/config.kdl" -SEQUENCES="$HOME/.cache/wallust/sequences" +# Written by the 'niri' entry in wallust.toml [templates] from +# ~/.config/wallust/templates/niri-colors.sh. Do NOT read +# ~/.cache/wallust/sequences instead: the picker runs `wallust run -qs`, and -s +# skips writing that file, so it silently goes stale and the border never +# changes. +COLORS="$HOME/.cache/wallust/niri-colors.sh" MARKER="// WALLUST-GRADIENT" [ -f "$CONFIG" ] || exit 0 -[ -f "$SEQUENCES" ] || exit 0 +[ -f "$COLORS" ] || exit 0 -# wallust writes the palette as terminal OSC sequences: ]4;;#RRGGBB -color_at() { - grep -oP "\]4;$1;#\K[0-9A-Fa-f]{6}" "$SEQUENCES" | head -1 -} +# shellcheck source=/dev/null +. "$COLORS" -FROM=$(color_at 4) -TO=$(color_at 6) +# wallust's {{colorN}} placeholders already carry the leading '#'; strip it so +# exactly one is added back below regardless of format. +FROM="${NIRI_BORDER_FROM#\#}" +TO="${NIRI_BORDER_TO#\#}" if [ -z "$FROM" ] || [ -z "$TO" ]; then exit 0 @@ -40,7 +45,7 @@ awk -v marker="$MARKER" -v from="#$FROM" -v to="#$TO" ' hit { match($0, /^[ \t]*/) indent = substr($0, 1, RLENGTH) - printf "%sactive-gradient from=\"%s\" to=\"%s\" angle=90 in=\"oklch longer hue\"\n", indent, from, to + printf "%sactive-gradient from=\"%s\" to=\"%s\" angle=90 in=\"oklch\"\n", indent, from, to hit = 0 next } diff --git a/.config/wallust/templates/niri-colors.sh b/.config/wallust/templates/niri-colors.sh new file mode 100644 index 0000000..19e01ea --- /dev/null +++ b/.config/wallust/templates/niri-colors.sh @@ -0,0 +1,5 @@ +# Generated by wallust — consumed by ~/.config/scripts/niri/wallust_niri_colors.sh +# Do not read ~/.cache/wallust/sequences instead: the wallpaper picker runs +# `wallust run -qs`, and -s skips writing that file, so it goes stale. +NIRI_BORDER_FROM="{{color4}}" +NIRI_BORDER_TO="{{color6}}" diff --git a/.config/wallust/wallust.toml b/.config/wallust/wallust.toml index af1010f..5063a2d 100644 --- a/.config/wallust/wallust.toml +++ b/.config/wallust/wallust.toml @@ -56,6 +56,7 @@ gtk2 = { template = 'gtk2.gtkrc', target = '~/.gtkrc-2.0.mine' } kdeglobals = { template = 'kdeglobals', target = '~/.config/kdeglobals' } qt5ct = { template = 'qt5ct-wallust.conf', target = '~/.config/qt5ct/colors/wallust.conf' } qt6ct = { template = 'qt6ct-wallust.conf', target = '~/.config/qt6ct/colors/wallust.conf' } +niri = { template = 'niri-colors.sh', target = '~/.cache/wallust/niri-colors.sh' } [hooks] # Resolve mix() and compute surface colors for GTK and QT theme_colors = """~/.config/scripts/shared/theme_colors.sh"""