about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-09-04 10:52:39 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-09-04 10:52:39 +0200
commit033a41cdcc28149a816d9605da1d07745cb7711e (patch)
treed272181662ed4f6f77973b591e614157575bc642
parentAdded optimize option (diff)
downloadsmart-wallpaper-033a41cdcc28149a816d9605da1d07745cb7711e.tar.gz
smart-wallpaper-033a41cdcc28149a816d9605da1d07745cb7711e.tar.bz2
smart-wallpaper-033a41cdcc28149a816d9605da1d07745cb7711e.zip
Improved optimize option
-rwxr-xr-xsmart-wallpaper15
1 files changed, 9 insertions, 6 deletions
diff --git a/smart-wallpaper b/smart-wallpaper
index 020c7ac..68437e3 100755
--- a/smart-wallpaper
+++ b/smart-wallpaper
@@ -11,6 +11,7 @@ input_daytimewallpaper=''
 input_nighttimewallpaper=''
 daytimewallpaper=''
 nighttimewallpaper=''
+currentwallpaper=''
 location=''
 
 currenttime='pn5Lf1f8SH' #random string so the first loop works
@@ -52,8 +53,7 @@ checkfullscreen(){
                 if [ "$fullscreen" == false ]; then
 			sleep 10
 			if [ "$WINDOW" = "$SCREEN" ]; then
-                		killall gifview
-				#pause shit
+                		killall gifview #pause shit
 			fi
 
 		fi
@@ -61,8 +61,8 @@ checkfullscreen(){
 		fullscreen=true
         else
                 if [ "$fullscreen" == true ]; then
-			drawwallpaper
-			#resume shit
+			checktime
+			drawwallpaper #resume shit
                 fi
                 
 		fullscreen=false
@@ -112,17 +112,21 @@ drawwallpaper(){
       if redshift -l $location -p | grep -i -q "day"; then
         currenttime="day"
         set_wallpaper "$daytimewallpaper"
+	currentwallpaper="$daytimewallpaper"
       else
         currenttime="night"
         set_wallpaper "$nighttimewallpaper"
+	currentwallpaper="$nighttimewallpaper"
       fi
     else
       if redshift -p | grep -i -q "day"; then
         currenttime="day"
         set_wallpaper "$daytimewallpaper"
+	currentwallpaper="$daytimewallpaper"
       else
         currenttime="night"
         set_wallpaper "$nighttimewallpaper"
+	currentwallpaper="$nighttimewallpaper"
       fi
     fi
   fi
@@ -187,10 +191,9 @@ if [ "$randomize" == false ]; then
   nighttimewallpaper=$(find $input_nighttimewallpaper -type f | shuf -n 1)
 fi
 
-if [ "$optimize" == true ]; then
+if [ "$optimize" == true ] && [ [ "$currentwallpaper" == *".gif" ] || [ "$currentwallpaper" == *".mp4" ] || [ "$currentwallpaper" == *".mov" ] || [ "$currentwallpaper" == *".avi" ] || [ "$currentwallpaper" == *".wav" ] ]; then
 	while true
 	do
-   		checktime
 		
 		checkfullscreen