How to keep a historical log of 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() {
    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!

Was this blog post helpful? Yes / No
Posted on September 28, 2015

« Back to blog archive


Download Focus and increase your productivity today