#!/bin/sh # Generate a blurred copy of WALLPAPER and set it as the awww backdrop layer. set -eu WP="${1:?usage: set-backdrop.sh }" CACHE_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/niri-backdrop" mkdir -p "$CACHE_DIR" name="$(basename "${WP%.*}")" blur="$CACHE_DIR/${name}-blur.jpg" # (re)generate the blur only if it is missing [ -f "$blur" ] || magick "$WP" -blur 0x40 -quality 85 "$blur" # wait for the backdrop daemon socket, then set the image for _ in 1 2 3 4 5 6 7 8; do if awww img --namespace backdrop "$blur" 2>/dev/null; then exit 0 fi sleep 0.5 done echo "set-backdrop: awww backdrop daemon not reachable" >&2 exit 1