-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Background
On macOS 15.x and later, Apple introduced changes to the window compositing and screen capture system. As a result, traditional methods for preventing window capture (including win.setContentProtection(true)
in Electron or setting NSWindow.sharingType = .none
in native apps) no longer work against the new ScreenCaptureKit framework.
Technical Details
-
Window Compositing in macOS 15+
AllNSWindow
contents are fully composited into a single framebuffer before being sent to the display.
ScreenCaptureKit
captures this framebuffer, meaning any visible window content is recorded regardless of flags or levels. -
NSWindow.sharingType
On macOS ≤14, settingsharingType = .none
could block capture.
On macOS 15+, Apple confirms via developer forums that this flag is ignored byScreenCaptureKit
. -
Legacy techniques
Hacks likeCGShieldingWindowLevel
or overlay windows are ineffective since the compositor merges all visible content. -
Implication for Tauri
Even if Tauri setsNSWindow.sharingType = .none
or similar protection flags, the window is still captured by ScreenCaptureKit on macOS 15+.
This matches behavior reported in Electron:🔗 Electron Issue #48258 – ScreenCaptureKit and setContentProtection
[Related tauri issue]
(#10213)
Summary
- On macOS 15+,
ScreenCaptureKit
captures all visible content. setContentProtection
/sharingType = .none
only block legacy CoreGraphics APIs, notScreenCaptureKit
.- This is a deliberate change by Apple and currently has no known workaround.