Focus Focus is a Mac app that helps you take back your productivity.

Productivity Automation

Focus is one of the Mac productivity apps that integrates into your workflow with automation.

Focus is an extremely powerful productivity tool for Mac.

From blocking distracting websites and distracting applications to locking timers and schedules so they can't be stopped—Focus is an incredible productivity companion.

Focus aims to work the way you work, which is why we offer Scripting so you can integrate Focus into other applications, and other applications into Focus.

Focus Scripting enables productivity automation and is one of the most advanced ways to level up your productivity.

Why should I script Focus?

Focus Scripting lets you automate your perfect productivity environment with 1-click. Spend a little time getting it set up, and you'll reap the rewards every Focus session.

Focus is great at calling other applications, and letting other applications call it. This makes it straightforward to integrate it and create the productivity routine of your dreams.

There are two main ways to automate productivity with Focus Scripting:

  1. Scripting Outside Focus — call Focus from other apps
  2. Scripting Inside Focus — call other apps from Focus

Scripting Outside Focus

Calling Focus from other applications is easy using Apple URL Handlers.

For example, if you have Focus installed—clicking these links will start and stop Focus—from your web browser!

Focus or Unfocus

Here's the HTML to perform this:

<a href="focus://focus">Focus</a> or <a href="focus://unfocus">Unfocus</a>

Notice instead of http:// or https:// links, they're focus:// links. This is how you call Focus from other applications.

It also works from the Terminal, turning Focus on

open "focus://focus"

Turn Focus off

open "focus://unfocus"

You can also start a timed Focus session

open "focus://focus?minutes=30&seconds=30"

Or just toggle between Focus and Unfocus states.

open "focus://toggle"

Here are all the commands you can use to interact with Focus from other applications:

Focus URL Description
focus://focus Start Focusing
focus://focus?minutes=30 Start Focusing for 30 minutes
focus://break?minutes=5 Start breaking for 5 minutes
focus://unfocus Stop Focusing
focus://unbreak Stop breaking
focus://toggle Toggle Focusing
focus://preferences Open preferences
focus://debug Show debug information

To learn more, read Scripting Focus with URL handlers.

Note: In Ventura, Apple changed the default shell from BASH to ZSH, which means Focus URLs should be wrapped in quotes, especially when query parameters are used.

Scripting Inside Focus

Focus can also call other apps. To get started, click the Focus menubar icon, then select Preferences in the drop-down menu.

Focus sits in your menubar to be quickly accessible, but otherwise stay out of the way.

Focus sits in your menubar to be quickly accessible, but otherwise stay out of the way.

Then select the Scripting panel from Focus Preferences, Focus should look like this:

Focus scripting can run at the start or end of a session. It can also run at the start or end of a break.

Focus scripting can run at the start or end of a session. It can also run at the start or end of a break.

Focus Scripting lets you run any BASH command when Focus starts, stops, starts breaking or stops breaking.

This lets you play custom sounds, display notifications, hook into other apps—anything you can think of.

BASH scripting literally lets you do anything, read more to learn how.

Focus BASH Scripting

BASH scripting is a simple programming language that runs in your Terminal. Because BASH scripts can call other programming languages like C, Python, PHP, AppleScript, JavaScript and more—Focus Scripting can do literally almost anything.

To learn how to create BASH scripts for Focus, consult your favorite programmer, AI assitant or app documentation. Also, you can email [email protected] and we'll be happy to help.

Scripting Environment Variables

Every Focus BASH Script gets called with environment variables to help give you the current state of Focus.

Here they are below, you can access them like $FOCUS_ACTIVE

Environment Variable Description
FOCUS_ACTIVE=0 or 1 Is Focus active or not?
FOCUS_HARDCORE_MODE=0 or 1 Is Focus in hardcore mode or not?
FOCUS_UNBLOCK_DATE=date Date when will Focus expire? (format like 2015-06-20 20:56:59 +0000)
FOCUS_INTERVAL=12345 If a timer was set, how long was it set for?
FOCUS_ACTUAL_INTERVAL=12345 Length of actual Focus session. Used in Unfocus
FOCUS_TYPE=normal or timer or schedule What kind of Focus session is this?

Note: when spawning a new BASH shell, Focus does not include your normal bash_profile or bashrc environment. Typically specifying the full path of scripts and executables is a good way for things to work despite not being in your normal environment.

Import, Export, and Reset to Defaults

Just like other Focus settings, you can import, export and reset Focus scripting back to defaults by accessing the settings cog at the bottom of the preferences screen.

Next Up

Productivity Automation is incredibly simple, whether you're trying to create your perfect environment, or hook Focus into your existing productivity workflow—Focus Scripting has everything you need.

Now that you've learned Focus Automation, learn some additional features like Drag and Drop to quickly add blocked distractions, Password Mode to lock preferences, and a Global Hotkey that lets you start a Focus session from anywhere.

Need help?

Email [email protected] with any questions about Focus, and we'll assist you as soon as possible!