Under the Hood of macOS ScreenCaptureKit: How kCGWindowSharingNone Excludes Stream Rendering
Technical deep dive into macOS ScreenCaptureKit (SCKit). Understand how Quartz WindowServer, Metal pipelines, and kCGWindowSharingNone isolate window buffers.
With macOS Sonoma and Sequoia, Apple re-architected screen capture pipelines around ScreenCaptureKit. Examining how WindowServer evaluates window properties explains the technical foundation of Chameleon's privacy exclusion.
The Migration from CGDisplayStream to ScreenCaptureKit
Historical screen recording on macOS relied on CGWindowListCreateImage and CGDisplayStream. In macOS 12.3+, Apple introduced ScreenCaptureKit (SCKit), delivering 60 FPS HDR capture with GPU-accelerated Metal frame buffers.
The CoreGraphics Window Sharing Contract
In Apple's Quartz CoreGraphics system, every window surface carries an integer sharing state:
kCGWindowSharingNone (0): The window cannot be read or captured by any other process.kCGWindowSharingReadOnly (1): The window can be captured by other processes.kCGWindowSharingReadWrite (2): Full remote accessibility.
How WindowServer Resolves Composited Z-Buffers
When SCKit requests a frame, WindowServer iterates through the active display list in back-to-front order. When it encounters a window with kCGWindowSharingNone, it suppresses the render pass for that layer. The underlying background surfaces remain unmodified in the output texture.
Performance Benchmarking: Zero CPU/GPU Overhead
Because exclusion is handled during the standard compositor pass, it introduces zero additional blit operations or memory copies. Chameleon runs at full 120Hz ProMotion refresh rates on MacBook Pro hardware without thermal throttling.