Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix permissions for macos 15 #3497

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
19 changes: 9 additions & 10 deletions src/logic/SystemPermissions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ class SystemPermissions {
// their return value is not updated during the app lifetime
// note: shows the system prompt if there's no permission
private static func screenRecordingIsGranted_() -> Bool {
return CGDisplayStream(
dispatchQueueDisplay: CGMainDisplayID(),
outputWidth: 1,
outputHeight: 1,
pixelFormat: Int32(kCVPixelFormatType_32BGRA),
properties: nil,
queue: .global(),
handler: { _, _, _, _ in }
) != nil
guard
let windows = CGWindowListCopyWindowInfo([.optionOnScreenOnly], kCGNullWindowID)
as? [[String: AnyObject]]
else { return false }
return windows.allSatisfy({ window in
let windowName = window[kCGWindowName as String] as? String
return windowName != nil
})
}

static func observePermissionsPostStartup() {
Expand Down Expand Up @@ -95,4 +94,4 @@ class SystemPermissions {
observePermissionsPreStartup(startupBlock)
}
}
}
}