Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

How I made a window invisible to screen sharing on macOS (and checked that it really is)

Description and use

The NSWindowSharingNone flag hides the window from screen captures on macOS while keeping it visible locally. A test script confirms zero pixels of the hidden window across three capture methods, but continuous verification is needed after OS updates.

Problem

Ensuring a floating window in a macOS app remains hidden from screen‑sharing captures while still visible to the local user.

Outcome

The NSWindowSharingNone flag successfully hides the window from all tested screen‑capture methods on macOS 26.6.2. The test script confirms zero pixels of the hidden window in captures while the normal window is fully captured.

Workflow

  • 1. Set the NSWindow's sharingType to NSWindowSharingNone via PyObjC.
  • 2. Configure window level, collection behavior, and hide‑on‑deactivate settings to keep it on top and across Spaces.
  • 3. Create a test with two windows (magenta hidden, green normal).
  • 4. Capture the screen using ScreenCaptureKit, macOS screencapture, and CGWindowListCreateImage.
  • 5. Count pixels of each color in the captures using NumPy.
  • 6. Verify the green window appears in all captures and the magenta window appears in none.
  • 7. Run the test after each macOS update to ensure continued compliance.

Evidence

Every NSWindow has a sharingType. Set it to NSWindowSharingNone and macOS leaves the window out of screen captures.

Source

On my MacBook (macOS 26.6.2, October 2026): 0 pixels of the hidden window in all three captures, while the ordinary window was captured every time (between 93k and 369k pixels, depending on the capture).

Source

ScreenCaptureKit still lists the window. Its title and position show up in the list of shareable windows. It just isn't drawn in the image.

Source

  • Record date: 2026-11-03T18:29:04.001Z