From c899327d6208e3dd42fca1f97d6ada25b938464d Mon Sep 17 00:00:00 2001 From: kentbetita Date: Fri, 1 Mar 2024 15:17:14 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20refine=20conditional=20accessibility?= =?UTF-8?q?=20prompt=20logic=20=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/ActiveWinCLI/main.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Sources/ActiveWinCLI/main.swift b/Sources/ActiveWinCLI/main.swift index 59b10d4..8610f06 100644 --- a/Sources/ActiveWinCLI/main.swift +++ b/Sources/ActiveWinCLI/main.swift @@ -89,12 +89,11 @@ let disableScreenRecordingPermission = CommandLine.arguments.contains("--no-scre let enableOpenWindowsList = CommandLine.arguments.contains("--open-windows-list") // Show accessibility permission prompt if needed. Required to get the URL of the active tab in browsers. -if - !disableAccessibilityPermission, - !AXIsProcessTrustedWithOptions(["AXTrustedCheckOptionPrompt": true] as CFDictionary) -{ - print("active-win requires the accessibility permission in “System Settings › Privacy & Security › Accessibility”.") - exit(1) +if !disableAccessibilityPermission { + if !AXIsProcessTrustedWithOptions(["AXTrustedCheckOptionPrompt": true] as CFDictionary) { + print("active-win requires the accessibility permission in “System Settings › Privacy & Security › Accessibility”.") + exit(1) + } } // Show screen recording permission prompt if needed. Required to get the complete window title.