Scripting Focus with URL handlers
Focus supports OS X URL handlers, which means you can turn it on and off from the browser, operating system and 3rd party apps.
In the browser
For example, try clicking the links below:
If you have Focus installed it will turn the app on or off (you may have to click approve if a dialog comes up).
Here's the HTML to perform this:
<a href="focus://focus">Focus</a> or <a href="focus://unfocus">Unfocus</a>
In the terminal
In the terminal, you could turn Focus on by typing
open focus://focus
Or turn Focus off
open focus://unfocus
You can also pass in a duration
open focus://focus?minutes=30&seconds=30
Or just toggle to a different state
open focus://toggle
Calendar
Focus has scheduling features, but with scripting it can also be turned on & off from your Calendar by using Automator & Calendar alarms. Here's how:
You can skip to step 5 if you want to download the existing Focus Automator workflows. Otherwise:
-
Open Automator and create a new Calendar Alarm workflow
-
Add a new Run Shell Script action
-
Add code to action that invokes Focus
/usr/bin/open focus://focus
-
Export the action. Also create an unfocus action if required.
-
Create a new event in Calendar with an alert type of Custom... (only works with regular Calendar events, not Google)
-
Select Open file and Other... for the first and second options
-
Select the exported Automator workflow from step 4 that triggers Focus
-
Set the last option to At time of event

Now, when your Calendar alarm goes off, Focus will run the Automator script which will turn Focus on or off.
3rd party apps
Focus is also easy to integrate with other 3rd party apps like Alfred.
Download the Alfred workflow and quickly enable or disable Focus with an alfred command.
Have other awesome Focus integrations? Let us know at @heyfocusapp or [email protected]

Drowning in distractions? They're chipping away at your productivity and focus. Fight back with Focus, the macOS app designed to block distractions and keep you on track. Regain your focus, achieve your goals, and find balance. Give Focus a try and see the difference it makes!
Download Focus
Try Focus free for 7-days!