Fix screen capture on macOS 26 (Tahoe)#1
Open
synistr wants to merge 1 commit intogetcompanion-ai:mainfrom
Open
Fix screen capture on macOS 26 (Tahoe)#1synistr wants to merge 1 commit intogetcompanion-ai:mainfrom
synistr wants to merge 1 commit intogetcompanion-ai:mainfrom
Conversation
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>
54d1778 to
00a6d34
Compare
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
Two deprecated CoreGraphics APIs are broken on macOS 26, silently breaking screen capture:
CGPreflightScreenCaptureAccess()returnsfalseeven when Screen Recording is granted (TCCauth_value=2). This causesmakeRandomComment()to bail on every cycle sinceScreenContext.hasPermissionis a guard. Fix: fall back to a 1×1CGWindowListCreateImageprobe.CGImage(windowListFromArrayScreenBounds:windowArray:imageOption:)returnsnilfor all inputs. This breaks the filtered capture (used to exclude Clawd's own windows from screenshots). Fix: fall back toCGWindowListCreateImage— Clawd's sprite may appear in screenshots as a minor trade-off.Also adds
-disable-availability-checkingtoPackage.swiftsince both APIs are marked obsoleted in the macOS 15+ SDK headers but still function at runtime.Test plan
CGPreflightScreenCaptureAccess()returnsfalseon macOS 26.3.1 with permission grantedCGWindowListCreateImagestill succeeds at runtimeCGImage(windowListFromArrayScreenBounds:)returnsnilon macOS 26🤖 Generated with Claude Code