From 351892e0e71742193a335fb909c637a22f05d7c7 Mon Sep 17 00:00:00 2001 From: kentbetita Date: Thu, 22 Feb 2024 17:55:37 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20omit=20URL=20from=20output=20?= =?UTF-8?q?=F0=9F=94=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/ActiveWinCLI/main.swift | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Sources/ActiveWinCLI/main.swift b/Sources/ActiveWinCLI/main.swift index 3e8e959..9a72290 100644 --- a/Sources/ActiveWinCLI/main.swift +++ b/Sources/ActiveWinCLI/main.swift @@ -71,13 +71,14 @@ func getWindowInformation(window: [String: Any], windowOwnerPID: pid_t) -> [Stri "memoryUsage": window[kCGWindowMemoryUsage as String] as? Int ?? 0 ] - // Only run the AppleScript if active window is a compatible browser. - if - let bundleIdentifier = app.bundleIdentifier, - let script = getActiveBrowserTabURLAppleScriptCommand(bundleIdentifier), - let url = runAppleScript(source: script) - { - output["url"] = url + // Run the AppleScript to get the URL if active window is a compatible browser and accessibility permissions are enabled. + if !disableAccessibilityPermission { + if let bundleIdentifier = app.bundleIdentifier, + let script = getActiveBrowserTabURLAppleScriptCommand(bundleIdentifier), + let url = runAppleScript(source: script) + { + output["url"] = url + } } return output