summaryrefslogtreecommitdiff
path: root/.config/niri/set-backdrop.sh
diff options
context:
space:
mode:
authorseraphim <18ycm9tx@anonaddy.me>2026-08-23 18:07:29 +0700
committerseraphim <18ycm9tx@anonaddy.me>2026-08-23 18:07:29 +0700
commited3e8f6ec6929327ab19e512ffb0d8ece12ed5a8 (patch)
treef1a783af87d29b8d78ce20df5a485f92b8c32d5d /.config/niri/set-backdrop.sh
parent3c71645d355910b6998e97a1efca6f5a7c7608bc (diff)
reorganize directories, so everything in .config
Diffstat (limited to '.config/niri/set-backdrop.sh')
-rwxr-xr-x.config/niri/set-backdrop.sh29
1 files changed, 29 insertions, 0 deletions
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 <name>-blur.<ext> 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 <image>" >&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