Focus is a Mac app that blocks distracting websites like Facebook and Reddit. Download Now

How to keep a historical log of Focus sessions

Scripting is a powerful feature of Focus that allows you to perform custom actions when Focus turns on and off.

For example, here’s how to write all of your sessions to a file so that you have a historical record of all the times you’ve used Focus.

Make sure you have a recent version of Focus and then go to Preferences > Scripting > Unfocus.

Scripting Unfocus

Copy and paste the following text to the text panel:

# Helper function to format the interval
convertsecs() {
    ((h=${1}/3600))
    ((m=(${1}%3600)/60))
    ((s=${1}%60))
    printf "%02d:%02d:%02d\n" $h $m $s
}

# Write out the session to our file
echo $(date) - Focused for $(convertsecs $FOCUS_ACTUAL_INTERVAL) >> ~/Documents/focus-sessions.txt

That’s it!

Now when you turn Focus off it will record your log to a file in your Documents folder called focus-sessions.txt, like this:

Tue Sep 15 12:25:43 PDT 2015 - Focused for 00:00:30
Tue Sep 25 12:25:43 PDT 2015 - Focused for 01:30:00
Tue Sep 29 12:25:26 PDT 2015 - Focused for 01:00:00



Learn more about scripting or contact support@heyfocus.com for help!


Download Focus and steal back your productivity. Get more work done, stay in the flow and create your perfect work environment with 1-click.

Stay up to date with the latest Focus updates and news