Skip to content

Commit

Permalink
Add support for getting the URL of the active tab in Arc on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 3, 2023
1 parent 5d13a66 commit e7265bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/ActiveWinCLI/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import AppKit

func getActiveBrowserTabURLAppleScriptCommand(_ appId: String) -> String? {
switch appId {
case "com.google.Chrome", "com.google.Chrome.beta", "com.google.Chrome.dev", "com.google.Chrome.canary", "com.brave.Browser", "com.brave.Browser.beta", "com.brave.Browser.nightly", "com.microsoft.edgemac", "com.microsoft.edgemac.Beta", "com.microsoft.edgemac.Dev", "com.microsoft.edgemac.Canary", "com.mighty.app", "com.ghostbrowser.gb1", "com.bookry.wavebox", "com.pushplaylabs.sidekick", "com.operasoftware.Opera", "com.operasoftware.OperaNext", "com.operasoftware.OperaDeveloper", "com.vivaldi.Vivaldi":
case "com.google.Chrome", "com.google.Chrome.beta", "com.google.Chrome.dev", "com.google.Chrome.canary", "com.brave.Browser", "com.brave.Browser.beta", "com.brave.Browser.nightly", "com.microsoft.edgemac", "com.microsoft.edgemac.Beta", "com.microsoft.edgemac.Dev", "com.microsoft.edgemac.Canary", "com.mighty.app", "com.ghostbrowser.gb1", "com.bookry.wavebox", "com.pushplaylabs.sidekick", "com.operasoftware.Opera", "com.operasoftware.OperaNext", "com.operasoftware.OperaDeveloper", "com.vivaldi.Vivaldi", "company.thebrowser.Browser":
return "tell app id \"\(appId)\" to get the URL of active tab of front window"
case "com.apple.Safari", "com.apple.SafariTechnologyPreview":
return "tell app id \"\(appId)\" to get URL of front document"
Expand Down Expand Up @@ -88,13 +88,13 @@ let enableOpenWindowsList = CommandLine.arguments.contains("--open-windows-list"

// Show accessibility permission prompt if needed. Required to get the complete window title.
if !AXIsProcessTrustedWithOptions(["AXTrustedCheckOptionPrompt": true] as CFDictionary) {
print("active-win requires the accessibility permission in “System PreferencesSecurity & Privacy › Privacy › Accessibility”.")
print("active-win requires the accessibility permission in “System SettingsPrivacy & Security › Accessibility”.")
exit(1)
}

// Show screen recording permission prompt if needed. Required to get the complete window title.
if !disableScreenRecordingPermission && !hasScreenRecordingPermission() {
print("active-win requires the screen recording permission in “System PreferencesSecurity & Privacy › Privacy › Screen Recording”.")
print("active-win requires the screen recording permission in “System SettingsPrivacy & Security › Screen Recording”.")
exit(1)
}

Expand Down

0 comments on commit e7265bc

Please sign in to comment.