fix: exclude software-dimming overlay windows from screen capture

For displays without DDC or gamma support (e.g. DisplayLink / virtual
displays), MonitorControl dims via a full-screen black 'shade' NSWindow.
Because the shade window's sharingType defaults to .readOnly, it is
captured by screenshots and screen recordings, so any capture taken
while a display is dimmed comes out darkened (see discussions #1453,
#866, #1446).

Set sharingType = .none on the shade windows and the gamma activity
enforcer so they no longer appear in screen captures. This is
display-only chrome; excluding it from capture does not change what the
user sees on screen.
This commit is contained in:
Seki Hiroyasu 2026-06-27 12:03:00 +09:00
parent 3cfc40598a
commit ed07a0ca53

View file

@ -21,6 +21,7 @@ class DisplayManager {
self.gammaActivityEnforcer.alphaValue = 1 * (DEBUG_GAMMA_ENFORCER ? 0.5 : 0.01)
self.gammaActivityEnforcer.ignoresMouseEvents = true
self.gammaActivityEnforcer.level = .screenSaver
self.gammaActivityEnforcer.sharingType = .none // exclude helper overlay from screen capture/recording
self.gammaActivityEnforcer.orderFrontRegardless()
self.gammaActivityEnforcer.collectionBehavior = [.stationary, .canJoinAllSpaces]
os_log("Gamma activity enforcer created.", type: .info)
@ -70,6 +71,7 @@ class DisplayManager {
shade.backgroundColor = .clear
shade.ignoresMouseEvents = true
shade.level = NSWindow.Level(rawValue: Int(CGShieldingWindowLevel()))
shade.sharingType = .none // dimming overlay must not appear in screenshots / screen recordings
shade.orderFrontRegardless()
shade.collectionBehavior = [.stationary, .canJoinAllSpaces, .ignoresCycle]
shade.setFrame(screen.frame, display: true)