Keep statistics on Focus sessions

How to keep a historical log of Focus sessions

Note: Statistics has been built in to Focus and is a better way to accomplish this for most people, though this method still works.

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 Documentsfolder 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 [email protected] for help!

Having a hard time staying on task because of distractions? Focus is an app for your Mac computer that helps you stay on track. It blocks things that can distract you so you can get your work done. Try Focus and see how much better you can do!
Download Focus
← Back to blog
Focus Productivity on September 28, 2015