Skip to content

Instantly share code, notes, and snippets.

@bmorton
Created March 14, 2011 17:56
Show Gist options
  • Save bmorton/869549 to your computer and use it in GitHub Desktop.
Save bmorton/869549 to your computer and use it in GitHub Desktop.
iTunes workaround to keep it from launching with the play key
#!/usr/bin/env python
import sys, os, subprocess
launch = True
blocker = ""
apps = ["Vox", "VLC"]
ps = subprocess.Popen("/bin/ps -x", shell=True, stdout=subprocess.PIPE)
for line in ps.stdout.read().split("\n"):
for app in apps:
if app in line:
launch = False
blocker = app
ps.stdout.close()
if launch :
os.spawnvp(os.P_WAIT, '/Applications/iTunes.app/Contents/MacOS/iTunesX', sys.argv)
else :
print "Not launching iTunes while %s is running." % blocker
cd /Applications/iTunes.app/Contents/MacOS
sudo mv iTunes iTunesX
sudo curl https://gist.github.com/raw/869549/9a0c66bec241afbe04af2aeb72677be5f5d2505d/iTunes -O
sudo chmod uog+x iTunes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment