Skip to content

Commit

Permalink
chore: refine conditional accessibility prompt logic 🔧
Browse files Browse the repository at this point in the history
  • Loading branch information
kentbetita committed Mar 1, 2024
1 parent 9c7207c commit c899327
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Sources/ActiveWinCLI/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit c899327

Please sign in to comment.