Skip to content

Keep Capsule resident in the menu bar until explicit quit#7

Merged
barscn merged 1 commit into
mainfrom
feat/menu-bar-residency
Jul 5, 2026
Merged

Keep Capsule resident in the menu bar until explicit quit#7
barscn merged 1 commit into
mainfrom
feat/menu-bar-residency

Conversation

@barscn

@barscn barscn commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

What & why

Closing the window used to fully quit Capsule. Now the app stays alive behind a menu bar item and quits only when the user explicitly chooses Quit (menu bar, app-menu ⌘Q, or the language relaunch).

Changes

  • Stay resident: CapsuleAppDelegate returns applicationShouldTerminateAfterLastWindowClosed = false, attached via @NSApplicationDelegateAdaptor in the @main shim (logic lives in CapsuleApp, shim stays thin).
  • MenuBarExtra with a basic, sensible menu: Open Capsule · Running Containers (live, click to reveal/select in the window) · Services status + Start/Stop Services · Settings… · Check for Updates… · Quit Capsule ⌘Q.
  • Own icon: menu bar uses Capsule's mark (the three bars) as a monochrome template glyph (MenuBarIcon), so macOS tints it for light/dark bars.
  • Single-window fix: main scene converted WindowGroup → single-instance Window, so openWindow(id:) focuses the existing window instead of stacking duplicates when reopening from the menu bar.
  • i18n: new strings localized into zh-Hans, ja, es, fr, tr.

Verification

  • make check (lint + architecture + license headers)
  • make test (886 tests, incl. new CapsuleAppDelegateTests)
  • make app builds the real bundle
  • ✅ Driven live: close window → app stays in menu bar; menu shows running containers; clicking a container reveals it in a single window (no duplicates); Quit terminates the process.

🤖 Generated with Claude Code

Closing the window no longer terminates Capsule. A CapsuleAppDelegate
returns applicationShouldTerminateAfterLastWindowClosed = false, so the
app stays alive behind a new MenuBarExtra and quits only on an explicit
terminate (menu bar Quit, app-menu ⌘Q, or the language relaunch).

The menu bar item uses Capsule's own mark as a monochrome template glyph
(MenuBarIcon) and offers a basic, sensible set of actions: Open Capsule,
a live Running Containers section (click to reveal/select in the window),
the runtime status with Start/Stop Services, Settings, Check for Updates,
and Quit Capsule.

Also converts the main scene from WindowGroup to a single-instance Window
so openWindow(id:) focuses the existing window instead of spawning
duplicates when reopening from the menu bar.

New user-facing strings are localized into zh-Hans, ja, es, fr, tr.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@barscn barscn self-assigned this Jul 5, 2026
@barscn barscn merged commit 7a90ad8 into main Jul 5, 2026
1 of 2 checks passed
@barscn barscn deleted the feat/menu-bar-residency branch July 6, 2026 11:18
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.

1 participant