Skip to content

Commit

Permalink
fix: don't check screen-recording permission if unnecessary
Browse files Browse the repository at this point in the history
closes #4113
  • Loading branch information
lwouis committed Jan 12, 2025
1 parent 4c3ec7d commit f3b116e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/logic/SystemPermissions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,22 @@ class SystemPermissions {
}

private static func checkPermissionsWhileAltTabIsRunning() {
Logger.debug(accessibilityPermission, screenRecordingPermission, preStartupPermissionsPassed, screenRecordingPermission, Appearance.hideThumbnails, Preferences.previewFocusedWindow)
SystemPermissions.updateAccessibilityIsGranted()
SystemPermissions.updateScreenRecordingIsGranted()
Logger.debug(accessibilityPermission, screenRecordingPermission, preStartupPermissionsPassed)
Menubar.togglePermissionCallout(screenRecordingPermission == .skipped)
Logger.debug(accessibilityPermission)
if accessibilityPermission == .notGranted {
Logger.info("accessibilityPermission not granted; restarting")
App.app.restart()
}
if screenRecordingPermission == .skipped || (Appearance.hideThumbnails && !Preferences.previewFocusedWindow) { return }
SystemPermissions.updateScreenRecordingIsGranted()
Logger.debug(screenRecordingPermission)
Menubar.togglePermissionCallout(screenRecordingPermission == .skipped)
if screenRecordingPermission == .notGranted {
// permission check may yield a false negative during wake-up
// we restart after 2 negative checks
if flakyCounter >= 2 {
Logger.info("screenRecordingPermission not granted 3 times; restarting")
App.app.restart()
} else {
flakyCounter += 1
Expand Down

0 comments on commit f3b116e

Please sign in to comment.