a11rew / calendar-focus-sync

Activate MacOS Focus Modes when calendar events begin
https://apps.apple.com/gh/app/calendar-focus-sync/id6472858223?mt=12
MIT License
6 stars 0 forks source link

Multiple Calendars with "custom" focus modes. #7

Open ostafford opened 2 weeks ago

ostafford commented 2 weeks ago

Hi Andrew,

I'm currently studying to become a full-stack developer like yourself. I'm currently learning Java Script and soon want to transition to Swift. I currently have 4 Calendars: Events - For Personal, Friends and Work events. Health - For GYM, Cycling, Health Appointments Blockout - Deep focus activities (Eg. Studying, Work, Code) Routine - Morning Routine, Lunch Routine, Evening Routine (Used to remind me to take a break ๐Ÿ˜…)

So at the moment i can only get "Do Not Disturb" to turn on for all of these events. Is it possible for me to edit the Shortcut to allow me to set a "Custom" focus for each calendar event or would i have to change the Xcode to do so? So for example when i'm studying for 4 hours which i've created an event under "Blockout" i want focus "Study" to turn on and then off once the event finishes and then when i go to the gym i want the "Health" focus to activate. So depending on the calendar and event the corresponding focus will trigger. Example - { if "event" is in "calendar" (Routine) and contains the word "Morning" turn on Focus "Routine" }

Feel free to reply or reach out if my questions doesn't make sense.

Thanks Andrew ๐Ÿ™๐Ÿพ

a11rew commented 1 week ago

Hi there @ostafford ๐Ÿ‘‹

Cool to hear about your dev journey, all the best!

Triggering different focus modes based on calendar events will need changes both in the source code here (Xcode) and in the Shortcut.

The Shortcut does not support triggering different focus modes based on a dynamic input. i.e. passing "Work" for example into the Shortcut like in the screenshot below will not trigger the "Work" focus mode, just turns on "Do not Disturb" all the time. Screenshot 2024-09-08 at 11 24 11

To support triggering different focus modes in the Shortcut therefore, we'd need to pattern match and then trigger specific predefined modes based on the input. Like so: Screenshot 2024-09-08 at 11 27 02

This is why this functionality hasn't been added to the app by default - there aren't really any other good ways to do this afaik and we can't generate Shortcuts dynamically to support this pattern matching for different users' Focus Modes. (Open to suggestions on solutions here of course)

For your scenario, you could update the default Shortcut this app installs with this pattern matching and update the function that calls the Shortcut to send the name of the Focus mode that should be activated to the Shortcut too