battery-stats icon indicating copy to clipboard operation
battery-stats copied to clipboard

exit gnuplot after close dialog

Open GHolk opened this issue 6 years ago • 0 comments

--persist option keep graph window live. however, because you remove the temp file, window often crash when zoom or panning.

i suggest that use pause mouse close which make gnuplot wait til window close. then you can remove temperary file safely after gnuplot exit.

this would be a easy patch like this. do you want me to send pull request?

--- /usr/bin/battery-graph	2016-11-17 18:51:44.000000000 +0800
+++ ./battery-graph	2019-01-02 22:10:36.559350289 +0800
@@ -217,10 +217,8 @@
     if $SWITCH_RATE ; then 
 		echo ", g(x -($TIME_LAST_DISCHARGE_BEGIN-$adjustment) ) title (B<0?sprintf(\"slope= (%.2f +/- %.2f) %/h\", B*3600, B_err*3600):\"\") lc rgb \"black\" lt 2 "
     fi
+    echo pause mouse close
     
-)  | gnuplot -persist ${geometry:+-geometry} $geometry ${title:+-title} "${title}" ; rm -f $TMPFILENAME
+)  | gnuplot ${geometry:+-geometry} $geometry ${title:+-title} "${title}"
 
-
-# TODO Have to decide if we want to clean up or leave the file for us to zoom in/out in the graph
-# For now we will just go the clean way and delete everything again.
 rm -f $TMPFILENAME

GHolk avatar Jan 02 '19 14:01 GHolk