From 52f5c119c06845612e098a0776bf799c4e80fe72 Mon Sep 17 00:00:00 2001 From: Ali Alavi Date: Mon, 24 Aug 2026 05:39:40 +0000 Subject: [PATCH] fix(mac): ensure hotkey registration on launch and direct modern macOS Sequoia Accessibility pane opening --- mac/src/AppDelegate.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/mac/src/AppDelegate.swift b/mac/src/AppDelegate.swift index f01a141..757411a 100644 --- a/mac/src/AppDelegate.swift +++ b/mac/src/AppDelegate.swift @@ -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!")