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

Only show warning on icon when a11y permission not granted #149

Merged
merged 1 commit into from
Aug 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion WakaTime/Watcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Watcher: NSObject {
var appVersions: [String: String] = [:]
var eventHandler: ((_ app: NSRunningApplication, _ path: URL, _ isWrite: Bool, _ isBuilding: Bool) -> Void)?
var statusBarDelegate: StatusBarDelegate?
var lastCheckedA11y = Date()
var isBuilding = false
var activeApp: NSRunningApplication?
private var observer: AXObserver?
Expand Down Expand Up @@ -121,7 +122,10 @@ class Watcher: NSObject {
self.statusBarDelegate?.a11yStatusChanged(true)
} catch {
NSLog("Failed to setup AXObserver: \(error.localizedDescription)")
self.statusBarDelegate?.a11yStatusChanged(false)
if lastCheckedA11y.timeIntervalSinceNow > 60 {
lastCheckedA11y = Date()
self.statusBarDelegate?.a11yStatusChanged(Accessibility.requestA11yPermission())
}
}
}

Expand Down
Loading