All of my important config files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
341 B

  1. #!/usr/bin/env zsh
  2. set -euo pipefail
  3. DIR="$HOME/Pictures/wallpaper"
  4. TMPLIST="/tmp/wallpaper-list"
  5. if [[ ! -e "$TMPLIST" ]]; then
  6. FILES=$(ls $DIR | shuf)
  7. echo "$FILES" >> "$TMPLIST"
  8. fi
  9. IMG=$(tail -n1 $TMPLIST)
  10. truncate -s "-$(( ${#IMG} + 1 ))" $TMPLIST
  11. feh "$DIR/$IMG" --bg-fill
  12. grep -q '[^[:space:]]' < "$TMPLIST" || rm "$TMPLIST"