Remember Everything with Timed Screenshots on Mac

I use TimeSnapper on windows.  It’s a great little app that lets me very quickly go back in time and see what I was doing.  It basically takes a screeshot every 10 seconds which I can then play as a video.  This comes in very handy specially when I am coding because sometimes I will make a bad change that breaks my code and can’t really remember how I got there.  Now I can go back in time and see what I was typing or doing.

I couldn’t find anything like this on the Mac, so I had to hack it together.  I have never done any shell scripting on the mac before, so this could all be wrong.  Any help is greatly appreciated.  Here is what I did:

Create a launchd agent

Basically, I created a plist file and saved it in ~/Library/LaunchAgents and called it me.screenshot.plist – see below:

The file above runs my shell script every 10 seconds and it starts running as soon as I login.

Create a shell script

The shell script simply creates a folder for the day and then takes a screenshot and saves it with the date and time in the filename to make it easy to sort and find specific files.  I put them in folder for every day for better organization.  I also generate 2 filenames to take a screenshot of both monitors, if the second monitor is disconnected, only 1 image is created. Here is the script

What’s missing? I Need Help

I would like to detect idle time and skip saving the screenshot if I am idle to save some storage space.  Any ideas?

UPDATE

I figured out how to detect idle time, so my mac isn’t just snapping away all day…   Here is the updated script.

Basically, it will not take a screenshot if the computer has been idle for 20 seconds or more.