Skip to content

Single-instance activation, window registry and tray icon - #20

Merged
moonolgerd merged 2 commits into
mainfrom
claude/planning-session-a042e4
Nov 17, 2026
Merged

moonolgerd merged 2 commits into
mainfrom
claude/planning-session-a042e4

Conversation

@moonolgerd

@moonolgerd moonolgerd commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Closes #11
Closes #12

Groundwork for the jump list (#13) and child windows (#19), plus the tray icon (#12) built on top of it.

What changed

  • ShutdownMode=OnExplicitShutdown; a new WindowRegistry tracks the open windows and quits the app when the last one closes (unless the tray is enabled).
  • One Bermuda per user via Windows App SDK AppInstance: a second launch forwards its activation to the running instance and exits. That covers --open <appId> (opens that App Directory app's window), a plain relaunch (brings the main window forward) and toast clicks that land on a second process.
  • WindowAppLauncher.Open opens an app window without an FDC3 instance id.
  • SINGLE_INSTANCE=false turns the behaviour off; SINGLE_INSTANCE_KEY isolates a run from an installed Bermuda. The Aspire host sets a key so dev and e2e runs stay apart.
  • A second process no longer clears the running instance's toasts on exit.

Tray icon (#12)

  • New TrayService (H.NotifyIcon.Wpf): left-click shows or hides the main window; the right-click menu offers Show Bermuda, New window and Quit.
  • Closing the main window hides it to the tray instead of exiting. TRAY_ENABLED=false turns this off (default true). Quit and session end (logoff/shutdown) still exit.
  • A launch from the MSIX startup task, or with --background, starts hidden in the tray.
  • If the tray icon cannot be created the app falls back to closing windows normally, so a hidden window is never stranded.
  • IsVisible added to the window controller (and the generated ipc.d.ts).

Testing

  • dotnet build and dotnet test: 58 unit tests pass.
  • New e2e/single-instance.spec.ts and e2e/tray.spec.ts (hide on close, restore via a second launch), sharing e2e/hostProcess.ts. Full e2e suite passes (129 tests) on isolated ports.
  • Not verified, needs a manual check in an interactive session: the tray icon's appearance, the right-click menu, the left-click toggle, and start-hidden at sign-in.
  • Not covered: the forwarded toast-click path (needs a real Windows toast click) and MSIX packaging.

🤖 Generated with Claude Code

…on (#11)

- ShutdownMode=OnExplicitShutdown; WindowRegistry tracks open windows and
  quits when the last closes (the tray icon will turn that off).
- One Bermuda per user via AppInstance: a second launch forwards its
  activation (including --open <appId> and toast clicks) to the running
  instance and exits. SINGLE_INSTANCE / SINGLE_INSTANCE_KEY configure it;
  the Aspire host sets a key so dev/e2e runs stay apart from an installed app.
- WindowAppLauncher.Open opens an app window without an FDC3 instance id.
- e2e specs for the second-launch behaviour.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 16, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Closing the main window now hides it to a notification-area icon instead of
exiting (TRAY_ENABLED, default true). Left-click toggles the main window; the
menu offers Show, New window and Quit. A launch from the MSIX startup task or
with --background starts hidden in the tray. If the tray cannot be created the
app falls back to closing normally, so a hidden window is never stranded.

Adds IsVisible to the window controller, shared e2e helper hostProcess.ts and
a tray e2e spec. Tray visuals, menu and start-hidden still need a manual check
in an interactive session.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@moonolgerd moonolgerd changed the title Explicit shutdown, window registry and single-instance activation Single-instance activation, window registry and tray icon Nov 17, 2026
@moonolgerd
moonolgerd merged commit c916796 into main Nov 17, 2026
3 of 4 checks passed
@moonolgerd
moonolgerd deleted the claude/planning-session-a042e4 branch November 17, 2026 02:31
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.

Tray icon with hide-to-tray Foundation: explicit shutdown, window registry, single instance

2 participants