Skip to content

Instantly share code, notes, and snippets.

@hsz
Created July 1, 2021 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsz/489f3c9d17ee5e0dd7279b473da93d9f to your computer and use it in GitHub Desktop.
Save hsz/489f3c9d17ee5e0dd7279b473da93d9f to your computer and use it in GitHub Desktop.
Play/pause Spotify with no iTunes action hijacking
on is_running(appName)
tell application "System Events" to (name of processes) contains appName
end is_running
if is_running("Spotify") then
tell application "Spotify" to playpause
else
tell application "Spotify"
activate
play
end tell
tell application "Finder" to set visible of process "Spotify" to false
end if
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment