#!/bin/bash # Push a blurred copy of a wallpaper to the awww-daemon backdrop namespace. # Prefers a pre-made -blur. sibling; otherwise generates one into the cache. # Used by theme-switcher.sh and apply-colors.sh for the niri Overview backdrop. set -euo pipefail IMG="${1:-}" if [ -z "$IMG" ] || [ ! -f "$IMG" ]; then echo "usage: $0 " >&2 exit 1 fi EXT="${IMG##*.}" SIBLING="${IMG%.*}-blur.${EXT}" if [ -f "$SIBLING" ]; then BLURRED="$SIBLING" else CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/niri-backdrop" mkdir -p "$CACHE_DIR" BASE=$(basename "${IMG%.*}") BLURRED="$CACHE_DIR/${BASE}-blur.jpg" if [ ! -f "$BLURRED" ] || [ "$IMG" -nt "$BLURRED" ]; then magick "$IMG" -blur 0x16 -quality 90 "$BLURRED" fi fi awww img "$BLURRED" -n backdrop echo "$BLURRED" >/tmp/current_backdrop_state