Skip to content

Instantly share code, notes, and snippets.

@mrf345
Created March 31, 2018 13:06
Show Gist options
  • Save mrf345/8912a139c8614899afcbd57c6eb70239 to your computer and use it in GitHub Desktop.
Save mrf345/8912a139c8614899afcbd57c6eb70239 to your computer and use it in GitHub Desktop.
feh wallpapers setting loop
#!/bin/bash
d=$1 # Directory
t=$2 # Duration
if [ "$1" == "" ];then
d=~/Pictures/Cities
fi
if [ "$2" == "" ];then
t=300 # 5 minuts
fi
l=$(ls -1q "$d" | wc -l) # number of files
while true
do
rindex=$[ $RANDOM % "$l" ] # start from random position
counter=1
for i in $(ls "$d")
do
img="$d/$i"
if [ -f $img ] && [ $counter -gt $rindex ];then
feh --bg-scale $img
# echo $img
sleep "$t"s
fi
counter=$(($counter + 1))
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment