Automations
Run scripts or perform actions automatically when a break starts or ends.
LookAway can trigger Apple Shortcuts or custom scripts when a break starts or ends. This lets you automate tasks like pausing music, enabling Do Not Disturb, dimming the screen, or locking your Mac.
Setting Up an Automation

- Open LookAway and go to Settings > Automation.
- Choose whether to run an action at the start or end of a break.
- Click "Add Shortcut..." to select an Apple Shortcut or "Add Script..." to enter a custom AppleScript or shell script.
- Save your automation, and LookAway will execute it when a break starts or ends.
Example: Pausing and Resuming Spotify

Here’s an example using AppleScript to pause Spotify when a break starts and resume it when the break ends.
Pausing Spotify at the start of a break:
This script checks if Spotify is running and playing music. If so, it pauses playback and records the time.
if application "Spotify" is running then
tell application "Spotify"
if player state is playing then
pause
do shell script "echo " & (do shell script "date +%s") & " > ~/Library/Application\\ Support/SpotifyPauseTime"
end if
end tell
end if
Resuming Spotify at the end of a break:
This script resumes playback if Spotify was paused within the last 60 seconds.
set maxPauseDuration to 60 -- 1 minute in seconds
try
set lastPauseTime to do shell script "cat ~/Library/Application\\ Support/SpotifyPauseTime"
set currentTime to do shell script "date +%s"
set timeDifference to (currentTime - lastPauseTime) as number
if timeDifference ≤ maxPauseDuration then
if application "Spotify" is running then
tell application "Spotify" to play
end if
end if
on error
-- No recorded pause time, so do nothing
end try
Example: Changing Slack status

Here’s an example using AppleScript to change your status in Slack to away
with a custom message when a break starts and back to online
when it ends.
First, we'll need to create a custom app in Slack and install it to our workspace where we need to change the status. Here's how you can do it.
Setting up the custom Slack app
- Go to https://api.slack.com/apps and sign in with your slack account.
- Click on Create an App button, and choose From a manifest.
- Select your workspace from the dropdown, and click next to create the app.
- Once you're at the app page, select the OAuth & Permissions option from the sidebar.
- Scroll down to Scopes, and under User Token Scopes, click Add an OAuth Scope.
- Here, you'll need to add the following scopes:
users:write
- required to set your status to away/onlineusers.profile:write
- required to set a custom status message
- Now, on the same page, scroll to the top, and click Install to <your-workspace>.
- Copy the User OAuth Token that appears after installing the app. We'll use this in the AppleScript to communicate with Slack.
Set Slack status to "Away" with a custom message
The following script will set your presence to "away", and set a custom message with an emoji. Replace xoxp-your-slack-token
with your actual OAuth token.
set slackToken to "xoxp-your-slack-token"
set customStatus to "{ \"status_text\": \"Taking a break\", \"status_emoji\": \":eyes:\" }"
-- Set the custom status
set setStatusCommand to "curl -X POST -H \"Authorization: Bearer " & slackToken & "\" -H \"Content-Type: application/json\" --data '{ \"profile\": " & customStatus & " }' https://slack.com/api/users.profile.set"
do shell script setStatusCommand
-- Set presence to away
set setAwayCommand to "curl -X POST -H \"Authorization: Bearer " & slackToken & "\" -H \"Content-Type: application/json\" --data '{\"presence\":\"away\"}' https://slack.com/api/users.setPresence"
do shell script setAwayCommand
Add this script to the Start of break section in Automation Settings.
Set Slack status back to "Online"
The following script will set your presence to "online", and clear any custom emojis or status messages. Again, replace xoxp-your-slack-token
with your actual OAuth token.
set slackToken to "xoxp-your-slack-token"
set clearStatus to "{ \"status_text\": \"\", \"status_emoji\": \"\" }"
-- Clear the custom status
set clearStatusCommand to "curl -X POST -H \"Authorization: Bearer " & slackToken & "\" -H \"Content-Type: application/json\" --data '{ \"profile\": " & clearStatus & " }' https://slack.com/api/users.profile.set"
do shell script clearStatusCommand
-- Set presence back to auto (online)
set setOnlineCommand to "curl -X POST -H \"Authorization: Bearer " & slackToken & "\" -H \"Content-Type: application/json\" --data '{\"presence\":\"auto\"}' https://slack.com/api/users.setPresence"
do shell script setOnlineCommand
Add this script to the End of break section in Automation Settings.
Other Automation Ideas
- Mute notifications during a break using an Apple Shortcut.
- Dim the screen when a break starts and restore brightness afterward.
- Enable Do Not Disturb mode automatically during a break.
- Lock the screen when a long break begins.
Automations allow LookAway to integrate into your workflow, making breaks more effective without manual adjustments.