Browse Source

Add script to change wallpaper

master
Schneider 5 years ago
parent
commit
a996cbd71f
Signed by: schneider GPG Key ID: 3F50B02A50039F3B
  1. 14
      change-wallpaper.sh

14
change-wallpaper.sh

@ -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"
Loading…
Cancel
Save