Skip to content

Instantly share code, notes, and snippets.

@thewatts
Forked from benkuhn/slack_watcher.scpt
Created November 20, 2015 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thewatts/47c5bf2e91cff4143eb5 to your computer and use it in GitHub Desktop.
Save thewatts/47c5bf2e91cff4143eb5 to your computer and use it in GitHub Desktop.
Pop up a notification prompting you to close Slack if it's open
tell application "System Events"
set activeApp to name of first process whose frontmost is true
end tell
if application "Slack" is running and activeApp is not equal to "Slack" then
tell application "Notifications Scripting"
# set show event handler results to true
set event handlers script path to (path to me)
display notification "Slack is running" message "Are you waiting on an @mention?" action button "No" other button "Yes"
end tell
end if
using terms from application "Notifications Scripting"
on notification activated activation type 2 # action button
tell application "Slack" to quit
end notification activated
end using terms from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment