diff options
-rwxr-xr-x | smart-wallpaper | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/smart-wallpaper b/smart-wallpaper index 53f729b..e9a0fe5 100755 --- a/smart-wallpaper +++ b/smart-wallpaper @@ -2,6 +2,8 @@ trap cleanup EXIT +period=500 + input_daytimewallpaper='' input_nighttimewallpaper='' daytimewallpaper='' @@ -10,10 +12,11 @@ location='' currenttime='pn5Lf1f8SH' #random string so the first loop works timebool=false +procid='' cleanup() { - if [[ $(pidof gifview | wc -l) == 1 ]]; then - kill $(pidof gifview) + if [[ $procid != '' ]]; then + kill $procid fi } @@ -28,14 +31,16 @@ print_usage() { set_wallpaper() { - if [[ $(pidof gifview | wc -l) == 1 ]]; then - kill $(pidof gifview) + if [[ $procid != '' ]]; then + kill $procid fi if [[ $1 == *".gif" ]] && [ -f /usr/bin/gifview ]; then gifview --animate -w root $1 & + procid=$! else feh --bg-fill $1 + procid='' fi } @@ -113,5 +118,5 @@ do fi fi - sleep 500s + sleep $period done |