Skip to content

Commit

Permalink
fix: remove accessibility prompt 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
kentbetita committed Feb 24, 2024
1 parent 9c7207c commit 4c16068
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions Sources/ActiveWinCLI/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ func getWindowInformation(window: [String: Any], windowOwnerPID: pid_t) -> [Stri
"memoryUsage": window[kCGWindowMemoryUsage as String] as? Int ?? 0
]

// Run the AppleScript to get the URL if the active window is a compatible browser and accessibility permissions are enabled.
// Only run the AppleScript if active window is a compatible browser.
if
!disableAccessibilityPermission,
let bundleIdentifier = app.bundleIdentifier,
let script = getActiveBrowserTabURLAppleScriptCommand(bundleIdentifier),
let url = runAppleScript(source: script)
Expand All @@ -84,19 +83,9 @@ func getWindowInformation(window: [String: Any], windowOwnerPID: pid_t) -> [Stri
return output
}

let disableAccessibilityPermission = CommandLine.arguments.contains("--no-accessibility-permission")
let disableScreenRecordingPermission = CommandLine.arguments.contains("--no-screen-recording-permission")
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)
}

// Show screen recording permission prompt if needed. Required to get the complete window title.
if
!disableScreenRecordingPermission,
Expand Down

0 comments on commit 4c16068

Please sign in to comment.