Skip to content

fix(sender): reuse the main window for control URLs - #221

Open
Betafer wants to merge 1 commit into
swellweb:maint-3.6from
Betafer:codex/fix-sender-duplicate-windows-3.6.1
Open

Betafer wants to merge 1 commit into
swellweb:maint-3.6from
Betafer:codex/fix-sender-duplicate-windows-3.6.1

Conversation

@Betafer

@Betafer Betafer commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Repeated targetbridge:// control requests currently create a new Sender main window each time. The official maint-3.6 App scene reproduces this: 12 requests leave 13 main windows.

Route external events to the existing main scene and remove the New Window command. Keep WindowGroup so closing the panel retains the existing background application lifetime; closing and reopening the panel still works. The production change is seven added lines in TBDisplaySenderApp.swift, including comments. The remaining files provide a reproducible lifecycle regression and its instructions.

Validation against maint-3.6 at 6fa46ac:

  • The final lifecycle runner fails on the original App scene with 13 windows after 12 URLs.
  • The corrected actual App scene passes 46 URLs, delivered exactly once and in order, with one main window: repeated and batched requests, hidden and minimized panels, open Settings, closing the main panel while the process remains alive, reopening through a URL, and five ordinary app reopens. New Window is absent. The fixture distinguishes closed windows from objects AppKit temporarily retains.
  • All 181 existing Sender tests pass with native XCTest in an isolated command-line host. Test bodies are unchanged; their imports are adapted to compile with production sources in the same module. This is not the normal application-hosted test run.
  • Full Sender Release build succeeds for arm64 and x86_64; the official Debug build-for-testing succeeds.
  • The regression scripts are excluded from the built app. Only the App scene, two test helpers and docs/Testing.md change; other existing files match the upstream base.

Runtime checks ran on Apple Silicon with macOS 26.6.1. The lifecycle fixture compiles the real App scene but uses inert service and automation collaborators, a unique bundle identifier and a unique URL scheme; it does not capture a display, send input or connect to a Receiver. The full public app was not installed or launched for streaming, and runtime behavior on Intel or older supported macOS versions was not re-tested here.

This prevents duplicate windows from normal control requests and the New Window menu; it is not a process singleton for forced launches and does not clean up previously restored duplicate windows. No capture, transport, rendering, pairing, permission handling, localization or version-number changes are included. Independent of #219 and #220; targets maint-3.6.

mjfrank added a commit to mjfrank/targetBridge that referenced this pull request Nov 16, 2026
)

Control URLs go to the existing main window instead of opening a new one,
and "New Window" is removed; fits the app modes, which bring back the one
main window. Includes the PR's window-lifecycle test tools. Original
change by Betafer (swellweb#221).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_015AiywzXyRsfrH6x9nyNXRQ
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