mirror of
https://github.com/lwouis/alt-tab-macos.git
synced 2026-05-24 11:20:36 +00:00
fix: avoid restarting alt-tab in some rare scenarios (#825)
This commit is contained in:
@@ -36,10 +36,20 @@ class SystemPermissions {
|
||||
}
|
||||
|
||||
static func observePermissionsPostStartup() {
|
||||
var counter = 0
|
||||
timer = Timer(timeInterval: 5, repeats: true, block: { _ in
|
||||
if !(accessibilityIsGranted() && screenRecordingIsGranted()) {
|
||||
if !accessibilityIsGranted() {
|
||||
App.app.restart()
|
||||
}
|
||||
if !screenRecordingIsGranted() {
|
||||
// permission check may yield a false negative during wake-up
|
||||
// we restart after 2 negative checks
|
||||
if counter >= 2 {
|
||||
App.app.restart()
|
||||
} else {
|
||||
counter += 1
|
||||
}
|
||||
}
|
||||
})
|
||||
timer.tolerance = 4.9
|
||||
CFRunLoopAddTimer(BackgroundWork.systemPermissionsThread.runLoop, timer, .defaultMode)
|
||||
|
||||
Reference in New Issue
Block a user