Window Name Tracking shows as not allowed sometimes, even when actually enabled.
Closed this issue · 1 comments
csatterfield commented
It seems that the window list used in this function can sometimes contain a window with a nil name, meaning the tracking will show as disabled even if its actually enabled.
func isWindowNameTrackingEnabled() -> Bool {
// 22.4.2020 - the latest privacy measures in Catalina require screen capture permission in order to access the window name of an application. See: https://stackoverflow.com/questions/56597221/detecting-screen-recording-settings-on-macos-catalina
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
})
}
A quick fix is to check for at least one non-nil window belonging to an application other than PersonalAnalytics, but this might still give an erroneous status. Is there a better way to do this check?
casaout commented
Closing as reported for legacy version of PersonalAnalytics.