From ed3e8f6ec6929327ab19e512ffb0d8ece12ed5a8 Mon Sep 17 00:00:00 2001 From: seraphim <18ycm9tx@anonaddy.me> Date: Sun, 23 Aug 2026 18:07:29 +0700 Subject: reorganize directories, so everything in .config --- .config/niri/set-backdrop.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 .config/niri/set-backdrop.sh (limited to '.config/niri/set-backdrop.sh') diff --git a/.config/niri/set-backdrop.sh b/.config/niri/set-backdrop.sh new file mode 100755 index 0000000..efd02b3 --- /dev/null +++ b/.config/niri/set-backdrop.sh @@ -0,0 +1,29 @@ +#!/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 \ No newline at end of file -- cgit v1.2.3