niri: automatically blur background

This commit is contained in:
2025-10-08 00:24:21 +02:00
parent bd1aab3533
commit 40106ac541
4 changed files with 28 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ elif [ "$XDG_CURRENT_DESKTOP" = "niri" ]; then
notify-send "Blurred Wallpaper set" "Selected wallpaper has been successfully applied for overview"
) &
nohup swww img "$image_copied" --transition-type fade --transition-duration 2 > /dev/null 2> /dev/null &
swww img "$image_copied" --transition-type fade --transition-duration 2 > /dev/null 2> /dev/null
notify-send "Wallpaper Changed" "$image"
else

23
.scripts/niri-autoblur Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
normal=$(find ~/.config/wallpaper-chooser/current -type f | head -n 1)
blurred=$(find ~/.local/share/swaybg -type f | head -n 1)
[ -n "$normal" ] || exit 1
[ -n "$blurred" ] || exit 1
while true; do
last=$target
mapfile -t focused_lines < <(niri msg focused-window 2>/dev/null)
if [ "${#focused_lines[@]}" -gt 1 ]; then
target="$blurred"
else
target="$normal"
fi
[ "$target" = "$last" ] || swww img "$target" --transition-type fade --transition-duration 0.5 > /dev/null 2> /dev/null
sleep 0.5
done