I could probably create something with cron, but maybe a neater solution already exists.
I could probably create something with cron, but maybe a neater solution already exists.
On macOS here's a little shell command to take a screenshot every 60 seconds and place it in the /tmp folder:
while true; do
screencapture /tmp/screen_capture_$(date +\%s).jpg ;
echo "wrote screenshot";
sleep 60;
done
You can also include the name of the front most application by fetching it with AppleScript and then putting that in the filename. (Or you could put different app screenshots in different folders) while true; do
FRONT_APP=$(osascript -e 'tell application "System Events" to name of first application process whose frontmost is true');
screencapture /tmp/screen_capture_${FRONT_APP}_$(date +\%s).jpg ;
echo "wrote screenshot";
sleep 60;
done
Of course if you want this to run long term, use a cron job or even better, a launchd job. With launchd you get better coalescing and sleep recovery behavior. You can also add other fun trigger events. Like take a screenshot every time your `.zshrc` is modified [0]. Or a screenshot every time your internet access changes (by triggering on /etc/resolv.conf)[0] Look up `WatchPaths` on my favorite launchd guide here: https://launchd.info/
Source:https://github.com/wanderingstan/Lifeslice
Download page: http://wanderingstan.github.io/Lifeslice/
I developed it as an early Quantified Self tool primarily for the Webcam shots, but also have been saved on more than one occasion by having screenshots of work that would otherwise be lost.
Edit: the first version was just a shell script, which if you want a starting point to modify: https://github.com/wanderingstan/Lifeslice/blob/master/1.0-S...
/$INTERVAL * * * /usr/sbin/screencapture $CRONSHOTSDIR/`date +\%s`.png
and then to make the timelapse:
ffmpeg -r $FPS -pattern_type glob -i "*.png" -vcodec libx264 lapse-`date +%s`.mp4
You have to give screen capture permissions to cron.
while sleep 5
do
import -id root `date -Is`.png
done
Then make a time lapse with mplayer et.al. $ which import
import not found
How should I install that tool?