summaryrefslogtreecommitdiff
path: root/scripts/bg.sh
blob: c6aaa61c3997862327ba58d6bf3931a5a727a1bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

feh --no-xinerama --bg-fill ~/.config/bg.png
exit

setbg="feh --force-aliasing --bg-tile "

image=~/.config/bg.gif
dir=/tmp/bggif  

printf "Converting..."
[ ! -d "$dir" ] || rm -rf "$dir"
mkdir -p "$dir"

convert -coalesce $image $dir/%05d.png
printf "done\n"

amount_of_frames=$(ls -1 "$dir" | wc -l)
frames_per_second=10
speed=$(echo "scale=3; ($amount_of_frames/$frames_per_second) * (1/$frames_per_second)" | bc -l)

while : ; do 
    for i in $(ls -1 $dir); do
        $setbg $dir/$i;
        sleep $speed
    done;
done