Skip to content

Instantly share code, notes, and snippets.

@youzi
Created March 9, 2018 08:49
Show Gist options
  • Save youzi/672f7690068bdf6a4475fd5620f553e1 to your computer and use it in GitHub Desktop.
Save youzi/672f7690068bdf6a4475fd5620f553e1 to your computer and use it in GitHub Desktop.
Schedule tasks in "pomodoro" calendar in Calendar to get "focus" and "break" notifications.
on run {input, parameters}
tell application "Calendar"
tell calendar "Pomodoro"
repeat
try
set currentEvents to first event whose start date ≤ (current date) and end date > (current date)
set currentSummary to currentEvents's summary
display notification currentSummary with title "Focus on:" sound name "Frog"
delay 1500
display notification currentSummary with title "Take a break from:" sound name "Frog"
delay 300
on error errMsg
exit repeat
end try
end repeat
end tell
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment