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

View File

@@ -123,7 +123,8 @@ spawn-at-startup "waybar"
// Wallpaper
spawn-sh-at-startup "swaybg -i $(find $HOME/.local/share/swaybg -type f) -m fill"
spawn-sh-at-startup "swww-daemon"
spawn-at-startup "swww-daemon"
spawn-at-startup "niri-autoblur"
// Not necessary maybe ...
spawn-at-startup "fcitx5"

View File

@@ -75,7 +75,8 @@
"today-format": "<b>{}</b>",
"on-click": "niri msg action center-column",
"on-scroll-up": "niri msg action set-column-width +10%",
"on-scroll-down": "niri msg action set-column-width -10%"
"on-scroll-down": "niri msg action set-column-width -10%",
"on-click-middle": "niri msg action close-window"
},
// System monitors
@@ -197,7 +198,6 @@
"format": "",
"separate-outputs": true,
"icon": true,
"on-click-middle": "niri msg action close-window",
"icon-size": 14
},
"custom/mediaplayer": {