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

Window Name Tracking shows as not allowed sometimes, even when actually enabled. #263

Open
csatterfield opened this issue Jun 18, 2020 · 0 comments
Assignees
Labels

Comments

@csatterfield
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants