Skip to content

feat(macos): add an optional native menu bar - #248

Closed
offline-first wants to merge 2 commits into
nuetzliches:mainfrom
offline-first:codex/macos-menu-bar
Closed

offline-first wants to merge 2 commits into
nuetzliches:mainfrom
offline-first:codex/macos-menu-bar

Conversation

@offline-first

Copy link
Copy Markdown
Contributor

macOS currently has no persistent entry point for the dashboard or registered stacks. This adds an optional devstack menubar command: one native AppKit status item with devstack's template logo, without a Dock window.

The menu provides:

  • Hub and stack status, including native services, Compose containers, failed candidates/rebuilds, and intentionally skipped profile services.
  • A paired dashboard, hub start/stop, per-stack start/stop and Open Folder.
  • Refresh Status and Give Feedback… (the GitHub issue chooser, without automatic log submission).
  • Quit Menu Bar, which leaves the hub and stacks running. Stopping the hub also keeps stacks running; stopping a main stack uses the existing down --infra command without --all.

Status collection and CLI actions run away from AppKit's main thread. The menu does not start a stopped hub during refresh, and shows progress/errors rather than silently assuming success. It installs no login integration. AppKit dependencies are macOS-only; other platforms report that the command is unavailable.

ADR-0060 is Proposed for maintainer review. This refines the unimplemented per-daemon tray idea in ADR-0018 into one optional client of the existing hub/registry. Related to #1 and the macOS preview in #66.

Validation

  • Tested on a real Apple Silicon Mac running macOS 26.7.1, using isolated generic demo stacks.
  • Exercised native-menu stack start/stop, hub stop/start, paired dashboard opening, GitHub feedback and quitting. Checked HTTP availability after lifecycle actions; quitting and stopping the hub left the running stack available. A second menu client was rejected.
  • The available UI automation attaches to windows, so menu interaction and the screenshot used a temporary neutral window hosting the same native NSMenu. That harness is absent from the contribution. The final windowless build was separately launched and checked on the Mac.
  • npm run build, cargo fmt --all -- --check, cargo clippy --workspace --all-targets --locked -- -D warnings, and cargo test --workspace --locked --no-fail-fast -- --test-threads=4 pass with Rust 1.98. Existing ignored integration tests remain ignored; this manual menu test did not exercise Docker.
  • Checked that Linux and Windows desktop dependency trees acquire no AppKit dependencies. Native builds on those platforms remain CI's check.

Screenshot

Native macOS menu with generic demo stacks

Only invented demo stack names are shown. Usage and a real-Mac verification checklist are in docs/macos.md.

@7schmiede

Copy link
Copy Markdown
Member

Thank you for this, and for testing it on a real Mac. It moved the long-deferred tray (#1) forward, and your AppKit adapter lives on in #249, where you are credited as co-author.

We are closing this PR in favour of #249 for two reasons:

  1. One tray for every platform, not a macOS-only command. The need is the same on Windows (where Tray icon for the hub (Windows first; Linux without losing the static build) #1 started) and Linux. feat(tray): a tray icon on Windows, Linux and macOS, a client of the hub (ADR-0060) #249 keeps your design of a separate client process, since AppKit wants the main thread, and makes it devstack tray everywhere: your status item on macOS, Shell_NotifyIconW on Windows, a StatusNotifierItem over zbus on Linux (the static binary stays static). The hub starts it, so it comes at logon without an autostart of its own. ADR-0060 records this in place of the proposed macOS-only ADR, and amends ADR-0018 and ADR-0021.
  2. The hub says what the tray shows. This PR read each daemon's /v1/stack every five seconds and judged services, containers, exit codes and profile skips on its own: a third reading of the state beside the dashboard's and the notifications', which would drift. feat(tray): a tray icon on Windows, Linux and macOS, a client of the hub (ADR-0060) #249 adds GET /hub/summary, built from the same streams the hub's notifications use (ADR-0045). The tray only draws it, and its actions are the dashboard's requests to the hub.

What changed in your adapter: the menu model moved to devstack-desktop::tray (shared by all three platforms), and the template icon is tinted orange while a stack starts or stops and red when something needs attention. #249 is not checked on a Mac yet; docs/macos.md has a short checklist (items 19–23). If you could run it on your machine, that would be the most useful review we could get.

@7schmiede 7schmiede closed this Oct 23, 2026
7schmiede added a commit that referenced this pull request Oct 23, 2026
…hub (ADR-0060) (#249)

* docs(adr): ADR-0060 the tray is a client of the hub, a process of its own, on every desktop

ADR-0018 put a tray in the daemon, ADR-0021 moved it to the hub, ADR-0045
took the notifications out of it. A contribution for macOS (#248) built a
menu bar client as a separate process and showed why: AppKit wants the
main thread, which the hub's server has. It also read every daemon's state
and judged it on its own, a third reading beside the dashboard's and the
notifications'.

The tray is `devstack tray` on every platform, started by the hub (off
with `devstack hub tray off` or `DEVSTACK_NO_TRAY`), a client of the hub:
`GET /hub/summary` says what it shows, the same as what notifies; its
actions are the dashboard's requests. One menu model, drawn per platform
(Shell_NotifyIconW, a StatusNotifierItem over zbus so the Linux binary
stays static, an NSStatusItem). ADR-0018 point 2 and ADR-0021 are amended.

Refs #1, #248

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(tray): a tray icon on Windows, Linux and macOS, a client of the hub (ADR-0060)

The hub starts `devstack tray` (unless `devstack hub tray off`,
`DEVSTACK_NO_TRAY`, or no desktop): the dashboard's mark, green when
something runs, amber while a stack starts or stops, red when something
needs attention, grey when nothing runs. Its menu opens the dashboard,
lists every registered stack with what needs attention (a click opens
that service), and starts, stops or opens a stack's folder, each a
request to the hub as the dashboard makes it. Quitting it stops nothing.

- `GET /hub/summary`: every stack at a glance and one state over all. What
  needs attention comes from the streams the hub follows for its
  notifications (`notify::rules::Scope::glance`), so the tray, the
  notifications and the dashboard agree; a failed start from the
  dashboard too.
- `devstack-desktop::tray`: one menu model, drawn per platform. Windows:
  `Shell_NotifyIconW` on a hidden window, re-added when Explorer restarts.
  Linux: a StatusNotifierItem with a dbusmenu over zbus, so the binary
  stays static; it registers again when a watcher appears. macOS: the
  AppKit status item from #248, tinted by state.
- One tray per user (a lock beside the hub's state); a tray of an older
  devstack than the hub's hands over to the new one. `devstack hub tray
  [on|off]`; `self uninstall` ends it with the hub.

Checked live on Ubuntu's GNOME (AppIndicator): the item registers, the
menu follows the summary, Stop, Start and Start Dashboard Hub work, off,
on and Quit end it. Windows and macOS are checked by clippy for their
targets only; docs/macos.md lists what a tester checks.

Closes #1
Replaces #248

Co-authored-by: offline-first <2144520+offline-first@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: offline-first <2144520+offline-first@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants