Scripting with Focus
Focus is scriptable, which means it can be extended to do a bunch of other cool stuff!
The two primary methods to script with Focus are BASH scripting and URL Handlers.
When Focus turns on and off, it can run custom BASH scripts which start/stop other programs, start playlists or even enable Do Not Disturb mode.
These panels are accessible in
Each script has access to Focus-specific environment variables that enable you to customize the scripts based on the state of Focus.
|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?|
Focus also supports being scripted from other applications, like the Browser, Terminal or Alfred.
For example, Focus can be enabled by clicking the following links:
|focus://focus?minutes=30||Start Focusing for 30 minutes|
|focus://debug||Show debug information|
Learn about more ways to use URL handlers.
Watch a tutorial on how to use advanced scripting to run custom actions when Focus turns on and off.
Contact email@example.com if you have any questions about Focus.