|
|
|
@ -74,6 +74,7 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
|
} |
|
|
|
RelayClient.shared.start() |
|
|
|
|
|
|
|
HotkeyManager.shared.registerHotkeys() |
|
|
|
checkInitialPermissions() |
|
|
|
} |
|
|
|
|
|
|
|
@ -143,15 +144,18 @@ public final class AppDelegate: NSObject, NSApplicationDelegate { |
|
|
|
|
|
|
|
if !axTrusted { |
|
|
|
print("AppDelegate: ⚠️ Accessibility not yet granted! Prompting user and monitoring...") |
|
|
|
// Open Accessibility pane directly |
|
|
|
// Open Accessibility pane directly on both modern and legacy macOS |
|
|
|
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { |
|
|
|
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility") { |
|
|
|
NSWorkspace.shared.open(url) |
|
|
|
if let url1 = URL(string: "x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension?Privacy_Accessibility") { |
|
|
|
NSWorkspace.shared.open(url1) |
|
|
|
} |
|
|
|
if let url2 = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility") { |
|
|
|
NSWorkspace.shared.open(url2) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Poll every 1.5 seconds until user toggles the switch |
|
|
|
permissionPollTimer = Timer.scheduledTimer(withTimeInterval: 1.5, repeats: true) { [weak self] timer in |
|
|
|
// Poll every 1.0 seconds until user toggles the switch |
|
|
|
permissionPollTimer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { [weak self] timer in |
|
|
|
let nowTrusted = AXIsProcessTrusted() |
|
|
|
if nowTrusted { |
|
|
|
print("AppDelegate: 🟢 Accessibility Permission GRANTED by user!") |
|
|
|
|