Repository navigation
feat(station): add Mac privacy curtain and phone-sized or 120 Hz virtual displays - #10511
Merged
Merged
Conversation
…ual displays
The Mac Helper now makes its own virtual display at phone sizes, upright or
turned (short side at least 360 points, long side at least 600, such as
390x844 and 844x390), with its modes at 60 or 120 Hz. It reuses the one
virtual display it already makes, sized so that display turns both ways, and
the Mac's display still mirrors it, so a mirrored panel shows it at the
panel's own rate. The offered physical display modes do not change.
The Helper also adds a privacy curtain (`curtain` op, `curtain` capability in
`hello`). While it is up, the Mac's own displays are black, a session event
tap holds the local keyboard and mouse, and the default output is muted. The
tap passes only events that carry the Helper's random per-process mark, which
the Helper sets on the viewer's input. Capture leaves out every Helper window,
so the viewer still sees the desktop. A view whose capture started before the
Helper had a window on screen gets a new filter once the curtain windows are
up. The Helper refuses the curtain with no view open, while an app has secure
event input on, without the event tap, or when it cannot silence an output
that is there. It mutes the output, or sets the volume to 0 on an output with
no mute, and it does the same to an output that becomes the default while
the curtain is up. It records each output by UID and restores each one later,
also on the next start after a crash.
Pressing Esc twice on the Mac within a second locks the screen, then takes the
curtain away. The Helper also locks first when the last view ends, on quit,
restart, or a termination signal, and when the station asks with `lock`. If
the screen does not report that it locked, the curtain stays up when the last
view ends or the station asks with `lock`. It still goes after an Esc or when
the Helper ends, so the person at the Mac can always get back in. The Helper
takes the curtain away for a named `owner` only if that owner put it up. It
answers a `lock` request after the screen reports locked, or with `on: true`
if it kept the curtain up. If a newly switched output cannot be silenced, the
Helper locks the screen and takes the curtain away.
The Node station gives the curtain only to a person's driving view
(`{t: "curtain", on}`), and the view that put it up holds it. When that view
only watches or ends, the station locks the screen and takes the curtain
away. It does not take away a curtain that another view put up later. The
station also locks first when the last view ends and before the Helper quits.
Only the driving person's own off request skips the lock. After an Esc on the
Mac, the station tells the view why and makes it only watch.
The Pion station has the same curtain input, holder (named to the Helper as
`owner`), lock, and Esc notice from the Helper's watch. A desktop view wakes
that watch, and the watch checks the curtain each time it connects. It also
now handles `{t: "resolution", width, height, hz?}` for the Mac and puts the
first mode back when the screen's last view ends, whether that view drove or
only watched. Resolution asks accept 360-point sides and an optional
`hz` of 60 or 120.
Changelog: 新增:远程控制 Mac 时可开启隐私幕布,本机屏幕黑屏、本地键鼠与扬声器被暂停,在本机连按两次 Esc 会先锁屏再结束幕布;虚拟屏支持手机竖横屏尺寸,并可选 60Hz 或 120Hz 模式
Changelog-parts: station
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ost or refused ask A Pion view whose curtain ask got no answer read the curtain back and took any `on: true` as its own, including another view's curtain that was still locking before it went. The Helper now says the holder (`owner`) when the curtain is read. The view claims the curtain only when that owner is its own serial, so a refused ask holds nothing and reports nothing up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
VirtualDisplay.swift,Resolution.swift):390x844and844x390) while keeping physical displayoffered()modes unchanged.CGVirtualDisplayDescriptortomax(pixelWidth, pixelHeight, 3840)on both axes so portrait/landscape rotation reuses the same display cleanly; support 60 Hz and 120 Hz mode selection (physical displays still mirror it).Curtain.swift,Daemon.swift,ScreenView.swift):curtainop andhello.capabilitiesentry (curtain): places black pass-throughNSWindowoverlays (sharingType = .none) on physical displays, intercepts local keyboard/mouse via.cgSessionEventTappassing only events tagged with a random per-processCurtain.mark, excludes Helper windows from ScreenCaptureKit (excludingApplications+unframedfallback when capture starts before Helper has an on-screen window), and silences default audio output (mute or per-channel volume-0 fallback, default-output switch listener, per-UID crash recovery marker).lock: true) locks first and keeps the curtain up if lock is not confirmed, while double-Esc and Helper quit/restart/signals always uncover so the local owner is never locked out.IsSecureEventInputEnabled()is active, without Accessibility event tap, or when audio cannot be silenced.station/src/screens/,station/src/mesh/screens.ts,pion/station-host/host_connects/):{t: "curtain", on}and{t: "resolution", width, height, hz?}(min side 360,hz60/120), atomic Helper-sideownertracking across overlapping views, eager Pion Helper watch wake + reconnect reconciliation, and per-source resolution restore when the last view (driving or watch-only) leaves.station.helper.curtain) synced across Node & Pion catalogs.Verification
swift test— 111/111 passed (pure-logic/mockFakeHost, avoiding macOS 27.0.1 WindowServer virtual display leak on shared host).tsgo --noEmitclean;screens.test.ts+mb-reader-contracts.test.ts+screen-input.test.ts— 112 passed, 1 skipped.pionc check+fmt --checkclean;host_connects— 143/143 passed.station-pion-sync.ts,changelog.ts,gen-i18n.mjs --check,gen-pion-i18n.mjs --checkall passed.Remaining Real-Mac Manual Smoke Checklist (before production reliance)
390x844 <-> 844x390virtual display creation/rotation and measure real SCK fps at 120 Hz mode.Prepared & reviewed with Gemini 4 Neon, Claude Opus 5.5, and GPT-6.2 Astra; verified via Swift Testing, Node test runner, and Pion test runner.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.