Skip to content

Instantly share code, notes, and snippets.

@dreness
Created October 9, 2022 04:45
Show Gist options
  • Save dreness/297c627c7ae7d0150669a73345b4c898 to your computer and use it in GitHub Desktop.
Save dreness/297c627c7ae7d0150669a73345b4c898 to your computer and use it in GitHub Desktop.
This is about as close as I can get to opening an app in the background from AppleScript.
-- can't get `open -g` to work...
tell application "System Events"
set prevApp to name of first process whose frontmost is true
end tell
tell application "mpv" to launch
tell application prevApp to activate
tell application "mpv"
open "thing_to_open"
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment