# Mac calendar Today's events in a Herdr panel, read straight from the macOS Calendar app. That covers every account the Calendar app syncs (iCloud, Google, Exchange) with no sign-in and no permission prompt. The header always says what's happening now or next. Upcoming meetings get a Join button, past ones fold away, and the panel sizes itself to its rows. ![Mac calendar](preview.png) ## What you see - **Header** (32px): `▾ Calendar · now`, or ` in 45m`, or `nothing left`, in `dim`. On the right: a gear (choose calendars) and a refresh icon. - **Rows** (20px each, 2px gap, 12px text): - all-day events first: `all day` and the title, both in `dim` - then `▸ N earlier`, which folds today's past events into one line - then the events still to come: a 52px time column (`9:30 AM`), the title truncated to fit, a badge, and `Join` when there's a meeting link - The event happening now and the next one get a `hover` background, their time in `accent`, and a badge (`now`, or `in 45m` / `in 1h 15m`). - The panel grows to fit its rows, up to 320px, then scrolls. - Errors from the database (for example, a schema change after a macOS update) show in `ansi1` red in place of the list. An empty day reads "Nothing on the calendar today". ## How it behaves - **Header click** folds the panel to 32px, and clicking again restores its size (`layout.resize`; the old size is kept in `shared("fold.")`). - **Gear** opens the calendar picker: calendars grouped by account, each with a checkbox. Your picks are saved in `shared("mac-calendar.include")`. With nothing picked, it shows every calendar except holidays and birthdays. - **Join** runs `open `. Links come from the event's conference URL, or from Zoom / Meet / Teams / Whereby / Around links found in the location, URL or notes. - **Refresh** reloads now. On its own it reloads every 3 minutes and redraws every minute so the badges count down. - **Left out:** declined events, cancelled events, reminders, and all-day "OOO" / "out of office" events. When the same event shows up on two calendars it's listed once. ## Built from - `mods/mac-calendar/main.js`: one `View`. It runs `exec("sqlite3", ["-readonly", "-json", , ])` against `~/Library/Group Containers/group.com.apple.calendar/Calendar.sqlitedb`, joining `OccurrenceCache`, `CalendarItem`, `Calendar`, `Store`, `Participant`, `Location` and `Conference`. Times are Cocoa seconds (+978307200). - It also uses `layout()`, `run("layout.resize")`, `shared` / `setShared`, `cx.timer.every`, and theme colors `dim`, `muted`, `accent`, `hover`, `foreground`, `raised`, `ansi1`. - Icons: `settings.svg` and `refresh.svg` in the mod folder. - Props: `block`, the layout block id this copy lives in (default `"mac-calendar"`). Folding and auto-height resize that id. - Layout: one block in a column, e.g. `{"id": "mac-calendar", "type": "block", "content": {"mod": "mac-calendar"}, "size": {"px": 200}}`. ## Watch out - **The block id must match `props.block`** (default `mac-calendar`). Otherwise folding and auto-height do nothing. - **The database is Apple's private schema.** It has held across recent macOS versions, but an update can rename a column. The panel then shows the sqlite error rather than wrong data. - **Only what the Calendar app syncs shows up.** Add accounts in System Settings → Internet Accounts. Freshness depends on the Calendar app's own sync. - No EventKit, since Herdr.app declares no calendar usage string. Reading the file with `sqlite3 -readonly` needs no prompt. The mod is read-only and never writes events. - macOS only. It runs `sqlite3` and `open`, and reads a file outside its folder. No network access. ## Done when - `herdr-app check ~/.config/herdr-app/mods/mac-calendar` passes and `herdr-app status` shows `errors: []`. - Today's events appear, matching the Calendar app, and declined events are missing. - The header names the current or next event, and the badge counts down within a minute. - The gear lists your calendars by account, and unticking one hides its events right away. - Clicking the header folds the panel to 32px, and clicking again restores it. - `Join` on an event with a Meet or Zoom link opens it in the browser.