Skip to content

Instantly share code, notes, and snippets.

@funkotron
Created February 8, 2014 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save funkotron/8878593 to your computer and use it in GitHub Desktop.
Save funkotron/8878593 to your computer and use it in GitHub Desktop.
#!/bin/bash
Dir="/home/a/Dropbox/wallpaper"
if [ ! -d "$Dir" ]; then
echo "Not Exist $Dir"
exit 1
fi
SetBG () {
while IFS= read -rd '' file; do list+=("$file"); done < <(find "$Dir" ! -type d -print0)
TotalFiles=${#list[@]}
RandomNumber=$(( $RANDOM % $TotalFiles ))
test ! $RandomNumber = 0 || RandomNumber=1
RandomFile="${list[RandomNumber]}"
#echo "Selected File: $RandomFile"
feh --bg-fill "${RandomFile}"
# exec nitrogen --set-fill "$RandomFile"
}
while true; do
SetBG
sleep 20m
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment