From d3498f1724d0d0f6af0821ba44d5570a8f70ffae Mon Sep 17 00:00:00 2001 From: Simon Studer Date: Sun, 5 Oct 2025 21:40:47 +0200 Subject: [PATCH] make niri config templateable --- config/niri/{config.kdl => config.template.kdl} | 8 ++++---- config/niri/generate_kdl.sh | 17 +++++++++++++++++ config/niri/wal.sh | 6 ++++-- 3 files changed, 25 insertions(+), 6 deletions(-) rename config/niri/{config.kdl => config.template.kdl} (99%) create mode 100755 config/niri/generate_kdl.sh diff --git a/config/niri/config.kdl b/config/niri/config.template.kdl similarity index 99% rename from config/niri/config.kdl rename to config/niri/config.template.kdl index 200a01d..ace6cc9 100644 --- a/config/niri/config.kdl +++ b/config/niri/config.template.kdl @@ -159,7 +159,7 @@ layout { // off // How many logical pixels the ring extends out from the windows. - width 3 + width 4 // Colors can be set in a variety of ways: // - CSS named colors: "red" @@ -167,13 +167,13 @@ layout { // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others. // Color of the ring on the active monitor. - active-color "#7fc8ff" + active-color "$focus_active" // Color of the ring on inactive monitors. // // The focus ring only draws around the active window, so the only place // where you can see its inactive-color is on other monitors. - inactive-color "#505050" + inactive-color "#005050" // You can also use gradients. They take precedence over solid colors. // Gradients are rendered the same as CSS linear-gradient(angle, from, to). @@ -283,7 +283,7 @@ hotkey-overlay { // Additionally, clients will be informed that they are tiled, removing some client-side rounded corners. // This option will also fix border/focus ring drawing behind some semitransparent windows. // After enabling or disabling this, you need to restart the apps for this to take effect. -// prefer-no-csd +prefer-no-csd // You can change the path where screenshots are saved. // A ~ at the front will be expanded to the home directory. diff --git a/config/niri/generate_kdl.sh b/config/niri/generate_kdl.sh new file mode 100755 index 0000000..7756d20 --- /dev/null +++ b/config/niri/generate_kdl.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +. "$HOME/.cache/wal/colors.sh" + +echo "$color1" + +export focus_active="$color2" +#export focus_inactive="$FOCUS_INACTIVE" +#export border_active="$BORDER_ACTIVE" +#export border_inactive="$BORDER_INACTIVE" +#export border_urgent="$BORDER_URGENT" + +# for simplicity, using envsubst: +envsubst <$HOME/.config/niri/config.template.kdl >$HOME/.config/niri/config.kdl + +# optionally force Niri to reload or redraw (if needed) +#niri msg action redraw diff --git a/config/niri/wal.sh b/config/niri/wal.sh index 7da1fdb..17097af 100755 --- a/config/niri/wal.sh +++ b/config/niri/wal.sh @@ -7,8 +7,6 @@ fi #wal -q -n --iterative -i ~/Pictures/niribg wal -q -n -i /usr/share/endeavouros/backgrounds/ -i /usr/share/endeavouros/backgrounds/eos_wallpapers_classic/ -i /usr/share/endeavouros/backgrounds/eos_wallpapers_community/ -notify-send -i "$(<"${HOME}/.cache/wal/wal")" "Theme Changed" - if [[ $(pidof waybar) ]]; then killall -SIGUSR2 waybar fi @@ -17,4 +15,8 @@ swaybg -m fill -i "$(<"${HOME}/.cache/wal/wal")" & $HOME/.config/mako/update_theme.sh +$HOME/.config/niri/generate_kdl.sh + niri msg action do-screen-transition --delay-ms 300 + +notify-send -i "$(<"${HOME}/.cache/wal/wal")" "Theme Changed"