Skip to content

feat(native): implement native macOS SnapShots capture, setup wizard, and settings UI (ST-SNAPSHOTS) - #463

Merged
rynfar merged 2 commits into
nativefrom
feat/native-snapshots
Nov 20, 2026
Merged

rynfar merged 2 commits into
nativefrom
feat/native-snapshots

Conversation

@rynfar

@rynfar rynfar commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Closes #99

Problem

ST-SNAPSHOTS in apps/native was still partial with SNAPSHOTS_UNAVAILABLE placeholder UI and no native capture backend, permission checks, global shortcut registration, setup wizard, or composer delivery pipeline.

Approach

  • Core settings & logic (crates/core/src/client_settings.rs, crates/core/src/settings/{mod,snapshot,search}.rs):
    • Added exact contract client settings (snapShotEnabled, snapShotIncludeAccessibility, snapShotShortcut, snapShotPlaySound, snapShotSound, snapShotFlash, snapShotAnimations) with defaults, per-key invalid fallbacks, atomic SnapShotSoundSelection patch support, and round-trip tests.
    • Ported SnapShotSettings.logic.ts, SnapShotSetupDialog.logic.ts, snapShotShortcut.ts, CaptureShortcutConfig.tsx, snapShotSource.ts, SnapShotCoordinator.tsx target-resolution/question-pinning helpers, and snapShot.ts system-conflict checks into crates/core/src/settings/snapshot.rs.
    • Added About search items "update-track" ("Update track") and "cli-command" ("t3 command") in crates/core/src/settings/search.rs while keeping the 5 child SnapShot search items anchored to "snap-shot-enabled" matching settingsSearch.ts.
  • macOS native capture backend (crates/app/src/snapshot_capture/{mod,macos}.rs):
    • Screen Recording (CGPreflightScreenCaptureAccess, CGRequestScreenCaptureAccess) and Accessibility (AXIsProcessTrusted, AXIsProcessTrustedWithOptions) checks + System Settings deep links (Privacy_ScreenCapture, Privacy_Accessibility).
    • Frontmost non-self window lookup via CGWindowListCopyWindowInfo + NSWorkspace, capture via /usr/sbin/screencapture -l <windowId> -o -x -t png <tempPath> with RAII temp cleanup, PNG header validation, image resize within MAX_CAPTURE_WIDTH x MAX_CAPTURE_HEIGHT and PROVIDER_SEND_TURN_MAX_IMAGE_BYTES, and bounded AX text extraction.
    • Global + local NSEvent shortcut monitor supporting modifier pairs and key chords with cooldown and clean teardown on disable/drop, plus NSSound shutter/whoosh playback using the embedded web audio assets.
    • Strictly gated behind #[cfg(all(target_os = "macos", not(test)))] and !is_os_side_effects_disabled() (--snapshot / tests) with SnapShotPlatform trait + MockSnapShotPlatform for deterministic unit and GPUI tests, plus a clean unsupported fallback on non-macOS.
  • Coordinator, Setup Wizard, & Settings UI (coordinator.rs, setup_dialog.rs, diffs_browser.rs, composer/attachments.rs, workspace.rs):
    • Mounted SnapShotCoordinator and 2-step SnapShotSetupDialog overlay in workspace.rs, added Composer::attach_snapshot_png(...) enforcing PROVIDER_SEND_TURN_MAX_ATTACHMENTS & question-attachment pinning, and replaced SNAPSHOTS_UNAVAILABLE in settings/diffs_browser.rs::snapshots_page() with full SnapShotSettings UI (enable switch, setup status & dialog launch, shortcut recorder + modifier-pair presets + conflict detection + Test capture, sound selector + preview button, flash/animations/accessibility toggles & resets).
  • Ledger (apps/native/parity/LEDGER.md): Updated ST-SNAPSHOTS -> done and cleared #99.

Verification

  1. vp fmt --check apps/native/parity/LEDGER.md: PASS
  2. node apps/native/scripts/gen-theme.ts --check: PASS
  3. node apps/native/conformance/generate.ts --check: PASS
  4. node --test apps/native/parity/sync.test.ts: 47 passed, 0 failed
  5. CARGO_INCREMENTAL=0 cargo clippy --manifest-path apps/native/Cargo.toml --workspace --all-targets -- -D warnings: PASS (0 warnings)
  6. CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-core: 1,875 unit + 8 conformance = 1,883 passed, 0 failed
  7. CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-client -- --test-threads=1: 167 passed, 0 failed
  8. T3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native -- --test-threads=1: 218 passed, 0 failed
  9. T3_NATIVE_HOME=$(mktemp -d) CARGO_INCREMENTAL=0 cargo test --manifest-path apps/native/Cargo.toml -p t3-native --features snapshot -- --test-threads=1 snapshot_capture diffs_browser: 10 passed, 0 failed
  10. CARGO_INCREMENTAL=0 cargo build --manifest-path apps/native/Cargo.toml -p t3-native: PASS

Built with Antigravity (Gemini 3.1 Pro).

@rynfar
rynfar merged commit b924e6a into native Nov 20, 2026
@rynfar
rynfar deleted the feat/native-snapshots branch November 20, 2026 07:29
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