Skip to content

Swift script that compiles into a binary to display upcoming events from the macOS Calendar app. It's designed for integration with SketchyBar but can be used anywhere. Unlike tools like iCalBuddy, this script avoids common macOS TCC (Transparency, Consent, and Control) permission issues by using the native EventKit framework.

Notifications You must be signed in to change notification settings

zigotica/macos-calendar-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 

Repository files navigation

MacOS Calendar Events

This is a small Swift script that compiles into a binary to display upcoming events from the macOS Calendar app. It's designed for integration with SketchyBar but can be used anywhere.

Unlike tools like iCalBuddy, this script avoids common macOS TCC (Transparency, Consent, and Control) permission issues by using the native EventKit framework.

πŸ› οΈ Compilation

You only need to compile the Swift script once:

swiftc CalendarEvents.swift -o ~/.config/sketchybar/calendar_events

You can change the output path or binary name as needed.

πŸ”– Selecting Calendars

Create a calendars.txt file in the same directory as the compiled script, listing the names of the calendars you want to include β€” one per line:

calendar A
calendar B

Only events from calendars listed in this file will be shown. If this file is not present, all calendars will be used.

Usage of compiled binary

You can pass the number of days to fetch as a command-line argument when running the compiled binary. For example, to fetch events for today and the next 2 days (3 days total):

~/.config/sketchybar/calendar_events 3

If no argument is provided, the default is 1 (only today). See my sketchybar config for an example of this.

Output

The binary prints upcoming events to stdout in this format:

09:00–10:00 | Daily Standup
14:30–15:00 | Design Review

Use the output as input for your SketchyBar plugin or other automation scripts. Enjoy a TCC-free, native way to display calendar events on your Mac!

πŸ§ͺ Debugging

To list all available calendar names (to help you build calendars.txt), uncomment the debug print section in the script:

for cal in store.calendars(for: .event) {
    print("- \(cal.title)")
}

Then recompile and run the binary to see the output.

About

Swift script that compiles into a binary to display upcoming events from the macOS Calendar app. It's designed for integration with SketchyBar but can be used anywhere. Unlike tools like iCalBuddy, this script avoids common macOS TCC (Transparency, Consent, and Control) permission issues by using the native EventKit framework.

Topics

Resources

Stars

Watchers

Forks

Languages