diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-06-30 19:21:26 +0200 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-06-30 19:21:26 +0200 |
commit | 8684189cedecb616e40e2546c1d2b1c3f1bc6e09 (patch) | |
tree | 1cf547f569762f8640447b62045cb7c8cfce7567 | |
parent | Formatting of readme (diff) | |
download | smart-wallpaper-8684189cedecb616e40e2546c1d2b1c3f1bc6e09.tar.gz smart-wallpaper-8684189cedecb616e40e2546c1d2b1c3f1bc6e09.tar.bz2 smart-wallpaper-8684189cedecb616e40e2546c1d2b1c3f1bc6e09.zip |
Added better wallpaper switch handling
-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 |