Skip to content

Fix screen capture on macOS 26 (Tahoe)#1

Open
synistr wants to merge 1 commit intogetcompanion-ai:mainfrom
synistr:fix/macos-26-screen-capture
Open

Fix screen capture on macOS 26 (Tahoe)#1
synistr wants to merge 1 commit intogetcompanion-ai:mainfrom
synistr:fix/macos-26-screen-capture

Conversation

@synistr
Copy link
Copy Markdown

@synistr synistr commented Apr 1, 2026

Summary

Two deprecated CoreGraphics APIs are broken on macOS 26, silently breaking screen capture:

  1. CGPreflightScreenCaptureAccess() returns false even when Screen Recording is granted (TCC auth_value=2). This causes makeRandomComment() to bail on every cycle since ScreenContext.hasPermission is a guard. Fix: fall back to a 1×1 CGWindowListCreateImage probe.

  2. CGImage(windowListFromArrayScreenBounds:windowArray:imageOption:) returns nil for all inputs. This breaks the filtered capture (used to exclude Clawd's own windows from screenshots). Fix: fall back to CGWindowListCreateImage — Clawd's sprite may appear in screenshots as a minor trade-off.

Also adds -disable-availability-checking to Package.swift since both APIs are marked obsoleted in the macOS 15+ SDK headers but still function at runtime.

Test plan

  • Verified CGPreflightScreenCaptureAccess() returns false on macOS 26.3.1 with permission granted
  • Verified CGWindowListCreateImage still succeeds at runtime
  • Verified CGImage(windowListFromArrayScreenBounds:) returns nil on macOS 26
  • Built patched binary, installed, confirmed proactive comments and chat both work

🤖 Generated with Claude Code

Two deprecated CoreGraphics APIs are broken on macOS 26:

1. CGPreflightScreenCaptureAccess() returns false even when Screen
   Recording permission is granted. Fall back to a 1x1 probe capture.

2. CGImage(windowListFromArrayScreenBounds:windowArray:imageOption:)
   returns nil for all inputs. Fall back to CGWindowListCreateImage
   (Clawd's own sprite may appear in screenshots as a trade-off).

Also adds -disable-availability-checking to Package.swift since both
APIs are marked obsoleted in the macOS 15+ SDK but still function
at runtime.

Tested on macOS 26.3.1 (25D771280a).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@synistr synistr force-pushed the fix/macos-26-screen-capture branch from 54d1778 to 00a6d34 Compare April 2, 2026 16:33
@synistr synistr changed the title Fix screen capture permission check on macOS 26 Fix screen capture on macOS 26 (Tahoe) Apr 2, 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.

1 participant