@ -0,0 +1,14 @@
#!/usr/bin/env zsh
set -euo pipefail
DIR="$HOME/Pictures/wallpaper"
TMPLIST="/tmp/wallpaper-list"
if [[ ! -e "$TMPLIST" ]]; then
FILES=$(ls $DIR | shuf)
echo "$FILES" >> "$TMPLIST"
fi
IMG=$(tail -n1 $TMPLIST)
truncate -s "-$(( ${#IMG} + 1 ))" $TMPLIST
feh "$DIR/$IMG" --bg-fill
grep -q '[^[:space:]]' < "$TMPLIST" || rm "$TMPLIST"