Lunavect: an open-source AppKit + SwiftUI menu bar app with WidgetKit widgets

A menu bar app that refreshes every few seconds and also feeds WidgetKit has to decide when a write is worth a widget reload. That's most of the interesting engineering in this project.

Lunavect is an MIT-licensed macOS 14+ app for people who run coding agents. It lists local Claude Code and Codex sessions with their state, keeps usage limits and per-project working time, and feeds a WidgetKit extension for limits and activity. It's an NSStatusItem with SwiftUI panels.

A few parts that might be interesting here:

  • A small bundled helper receives the tools' lifecycle hook events and keeps session identity, state, tool name and timestamps, not prompts or tool arguments.
  • UI state stays on the main actor. Snapshot and activity persistence run on separate serial utility queues, and an equal successful write doesn't rewrite the file or reload widgets.
  • Startup and termination are still synchronous boundaries. The architecture notes say why and what it costs: Lunavect/docs/architecture.md at main · lovach/Lunavect · GitHub

I'd like opinions on that last point: in a small menu bar utility that also feeds widgets, how do you handle the final flush on quit?

The screenshot uses sample sessions. Source: GitHub - lovach/Lunavect: Claude Code and Codex in your Mac menu bar: see which AI coding agent is working, waiting for you or running background tasks, get alerts before weekly and 5-hour usage limits run out, and add desktop widgets. Free, open source, native macOS. · GitHub

1 Like