Skip to content

Live capture for remote viewers, JPEG on macOS, cached display list - #13

Merged
sheehanmunim merged 1 commit into
mainfrom
feat/live-capture
Oct 2, 2026
Merged

sheehanmunim merged 1 commit into
mainfrom
feat/live-capture

Conversation

@sheehanmunim

Copy link
Copy Markdown
Member

MT Code's Computer View polled screenshot up to 30 times a second. Each frame enumerated displays, set up a capture and encoded it, and then the viewer compared bytes to find out whether anything had moved. That measured ~100 ms a frame on macOS and Windows, and the macOS helper only produced PNG (~400–600 KB a frame).

What changes

  • screenshot { display, live: true, after?, wait_ms? } keeps a capture stream open: ScreenCaptureKit on macOS, Desktop Duplication on Windows. It answers with the newest frame plus a live: {"seq","changed"} line. With after, it waits until the screen changes past that frame. Like cursor: true, this is viewer-only and not in the tool schema. Linux and unsupported displays (rotated or HDR desktops, remote sessions) answer with an ordinary screenshot and no live line, so a viewer keeps polling.
  • The stream stops itself 5 s after the last request, so macOS's purple screen-recording indicator only shows while someone is watching. If the user stops sharing from the menu bar, live capture stays off until the viewer is reopened.
  • macOS screenshot/zoom now honour format and quality like Windows/Linux. Both are now in the Swift schema, and the parity allowance is gone.
  • macOS keeps the display list between captures and drops it when screens change.

Measured

  • macOS (this Mac): live frame ~2 ms; one-shot PNG 120 → 90 ms; JPEG ~105 KB instead of 576 KB PNG.
  • Windows (Blade, run in the desktop session): live frame <1 ms when nothing changed; one-shot ~100 ms as before. The stream reopens after going idle.

Not tested: lock screen and UAC (Desktop Duplication cannot read the secure desktop; the code returns a clear error and reopens when it closes). Multi-monitor Windows (Blade has one display).

🤖 Generated with Claude Code

MT Code's Computer View polled `screenshot` up to 30 times a second: every
frame enumerated displays, set up a capture, encoded it, and the viewer then
compared bytes to learn nothing had moved. Measured ~100 ms a frame on both
macOS and Windows, and the macOS helper only produced PNG (~400-600 KB).

- `screenshot { display, live: true, after?, wait_ms? }` keeps a capture
  stream open (ScreenCaptureKit on macOS, Desktop Duplication on Windows) and
  answers with the newest frame plus a `live: {"seq","changed"}` line. Given
  `after`, it waits until the screen changes past that frame, so an idle
  viewer costs nothing. Viewer-only and absent from the tool schema, like
  `cursor: true`. Linux and unsupported displays answer with an ordinary
  screenshot (no live line), which the viewer treats as "keep polling".
- The stream stops itself 5 s after the last request, so the macOS
  screen-recording indicator is only up while someone is watching. Stopping
  it from the menu bar is honoured for the life of the process.
- macOS `screenshot`/`zoom` honour `format` and `quality` like Windows/Linux
  (both now in the Swift schema; the parity allowance is gone).
- macOS keeps the display list between captures (dropped on screen changes),
  so a display screenshot no longer walks every window on screen first.

Measured: macOS live frame ~2 ms (one-shot PNG 120 -> 90 ms, JPEG ~105 KB
vs 576 KB PNG); Windows live frame <1 ms when nothing changed (Blade).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 2, 2026 02:30

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 reached their quota limit.

@sheehanmunim
sheehanmunim merged commit 0893a3f into main Oct 2, 2026
4 checks passed
@sheehanmunim
sheehanmunim deleted the feat/live-capture branch October 2, 2026 02:49
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