Skip to content

Commit

Permalink
Tweak permissions again
Browse files Browse the repository at this point in the history
Further addresses #384
  • Loading branch information
jordanbaird committed Oct 1, 2024
1 parent f9d5029 commit 5720a99
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions Ice/Permissions/Permission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,8 @@ class Permission: ObservableObject {
/// if the request does not do so.
func performRequestAndOpenSettingsPaneIfNeeded() {
request()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {
// Workaround for a bug where the request fails to automatically open the settings pane.
// Check for the panel that prompts the user to open System Settings, and try to open the
// settings pane manually if it doesn't exist.
if WindowInfo.getAllWindows().first?.owningApplication?.bundleIdentifier != "com.apple.accessibility.universalAccessAuthWarn" {
if let settingsApp = NSWorkspace.shared.runningApplications.first(where: { $0.bundleIdentifier == "com.apple.systempreferences" }) {
// If the System Settings app is already running, it could open the settings pane
// without activating, so we need to do that manually.
settingsApp.activate(from: .current)
}
if let settingsURL = self.settingsURL {
NSWorkspace.shared.open(settingsURL)
}
}
if let settingsURL {
NSWorkspace.shared.open(settingsURL)
}
}

Expand Down Expand Up @@ -121,7 +109,7 @@ final class AccessibilityPermission: Permission {
"Get real-time information about the menu bar.",
"Move individual menu bar items.",
],
settingsURL: URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"),
settingsURL: nil,
check: {
checkIsProcessTrusted()
},
Expand Down

0 comments on commit 5720a99

Please sign in to comment.