Skip to content

[RFC] Automatic iMac monitor mode — integrated prototype - #157

Closed
Betafer wants to merge 1 commit into
swellweb:dev-3.4.0from
Betafer:codex/imac-monitor-mode-pr
Closed

Betafer wants to merge 1 commit into
swellweb:dev-3.4.0from
Betafer:codex/imac-monitor-mode-pr

Conversation

@Betafer

@Betafer Betafer commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Integration preview — not ready for line-by-line review

I discovered TargetBridge while looking for a practical way to reuse a 21.5-inch 2017 Retina 4K iMac as the display for a Mac mini M4. Apple's Target Display Mode is not available on this iMac, while ordinary screen sharing was too slow for comfortable daily use.

I really liked TargetBridge's approach: instead of pretending the iMac is a physical DisplayPort monitor, it creates a virtual display on the Sender and carries a low-latency video stream to the Receiver. Starting from that design, I tested it with Thunderbolt, USB4/USB-C networking, direct Ethernet and Wi-Fi, then gradually added the pieces that made the setup feel closer to a real monitor: automatic startup, reliable Stop/Start, cable selection, 4K60, optional input control and separate audio controls.

This draft PR is the fully integrated and hardware-tested prototype. It is intentionally kept as a reference, not as a request to merge all 62 changed files at once. I plan to submit the useful parts as smaller, focused PRs so the project author can choose what fits TargetBridge.

Proposed functional split

Proposal Utility Independence
#160 — Native Retina 4K + stable 60 FPS Adds the 4096 × 2304 profile, receiver-native capture and the paced HEVC pipeline Extracted as a standalone draft PR
#159 — Thunderbolt, USB4, Ethernet and Wi-Fi path selection Identifies each macOS network path, measures viable links and selects the fastest one Extracted as a standalone draft PR
#161 — Reliable headless monitor lifecycle Login-safe startup, persistent user Stop, reconnect and headless display wake Extracted as a standalone draft PR
Receiver-side Start/Stop and path controls Lets the iMac operate a headless Sender without a second Mac mini display Optional monitor-mode layer
iMac keyboard, mouse and clipboard control Optional input relay with permission, focus and lock-up safeguards Optional
Audio and display controls Independent Sender/Receiver volume plus Receiver display-state reporting Optional
#162 — Receiver notification shielding Keeps local iMac banners behind the active fullscreen video and restores normal level on Stop Extracted as a standalone draft PR
Integrated installer Friendly setup of the accepted monitor-mode components and login items Packaging, proposed last

USB4 clarification

The USB4 work does not turn the iMac into a native USB-C/DisplayPort sink and does not assume the cable will provide a 40 Gbit/s video path. TargetBridge still uses its encoded network protocol. The change detects the network interface macOS exposes over a direct USB/USB4 connection, keeps it distinct from Thunderbolt Bridge, performs a bounded real transfer test, and chooses it only when it is the fastest working route.

This also means cable labels are not trusted: Thunderbolt, USB4, Ethernet and Wi-Fi are compared by measured application-level throughput.

What the integrated prototype demonstrates

  • Automatic Sender and Receiver startup with transient-failure recovery.
  • A persistent user Stop that does not immediately reconnect.
  • Receiver-side control of a headless Mac mini.
  • Native 4096 × 2304 @ 60 streaming on the 2017 Retina 4K iMac.
  • Automatic preservation of the upstream 5K profile on 27-inch panels.
  • Optional keyboard, mouse, gestures and clipboard relay.
  • Independent audio controls and Receiver display controls.
  • Notification shielding, single-instance ownership and stale-session recovery.
  • A universal installer that detects the Sender or Receiver Mac.

Validation

  • Mac mini M4 Sender and 21.5-inch 2017 Retina 4K iMac Receiver.
  • 180.598 seconds of continuous full-screen high-entropy motion.
  • Source: 13,536 frames at 74.95 FPS.
  • Sender: sustained 60 FPS.
  • Receiver: predominantly 59–61 FPS.
  • Zero pre-encode drops, zero post-encode drops and no packet backlog.
  • Automatic recovery verified across three Sender restarts and one Receiver restart in approximately 3.1–7.4 seconds.
  • Sender XCTest: 125 tests, 0 failures.
  • Receiver parser, lifecycle, recovery, loopback and monitor-mode smoke suites passed.
  • Sender helper: 22 checks, 0 failures.
  • Integrated installer: 13 checks, 0 failures.

Security and setup notes

Screen Recording permission remains required on the Sender because macOS controls access to captured display frames. Optional Receiver-initiated recovery uses a locally provisioned restricted SSH key and pinned host key; no credentials, personal usernames, hostnames or private network addresses are included.

The integrated installer UI is currently Italian. I would propose packaging only after the underlying functions and their preferred upstream shape are agreed.

Feedback on the preferred order or scope of the smaller PRs is very welcome.

@Betafer Betafer changed the title Add automatic iMac monitor mode with stable 4K60 streaming [RFC] Automatic iMac monitor mode — integrated prototype Aug 7, 2026
@swellweb

Copy link
Copy Markdown
Owner

Thank you for the thorough monitor-mode prototype. The focused, production-tested parts of this work are now included in TargetBridge 3.5.0 through #159 (measured connection paths) and #161 (headless lifecycle and persistent user Stop).

To keep the release branch stable and future reviews focused, I am closing this integrated RFC. The remaining monitor-mode and installer ideas are welcome as smaller, rebased follow-up PRs with focused tests. Thanks again for the work and careful collaboration.

@swellweb swellweb closed this Aug 10, 2026
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