Thursday, May 21, 2015

Change Mac Calendar all-day event reminder time to something other than 9am

Kudos for the many who have provided those undocumented or not-well-known features for the Mac Calendar.  There are many.

Scenario: I'm working productively when suddenly every day I get a dump of 15 event notifications that end up blocking the view of what I'm working on.  My colleagues work on EDT while I'm on PDT.  By 9am, I'm already in the thick of my day.  I would rather the all day events not interrupt me at that time.  Five Awesome Tips And Tricks To Master OS X Calendar [Feature] provides some guidance on how to change that as the Calendar preferences are limited; they expect everyone wants to be notified at 9am.

As mentioned in the article, you can override the "trigger" time for all day events by editing

# find all files under ~/Library/Calendars/
# whose path includes LocalDefaultAlarms
# whose name does not include EventTimed
# open in favorite editor

grep -rl TRIGGER ~/Library/Calendars/ | grep LocalDefaultAlarms | grep -v EventTimed | xargs mvim -p
Simply edit the configuration files to the desired trigger time specified. Hours can be negative or positive and represent the offset from midnight of the day of the all-day event. For me, instead of being reminded at 9am the day before, I would rather be reminded at 7am instead, which turns out to be 17 hours before midnight for the all-day events.

# if you vim

:%s/PT15H/PT17H/g
If you want to get fancy, you could come up with a bash script that uses sed so the files don't even need to be opened in a text editor.