Created
April 14, 2010 17:05
-
-
Save jmlacroix/366061 to your computer and use it in GitHub Desktop.
Small bash script to prevent iTunes from opening when pressing media keys to control other applications such as Ecoute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
IPATH="/Applications/iTunes.app/Contents/MacOS" | |
if [ ! -e "$IPATH/iTunesX" ] | |
then | |
sudo mv "$IPATH/iTunes" "$IPATH/iTunesX" | |
# has sudo failed? | |
if (( $? )) | |
then | |
exit | |
fi | |
sudo cat > "$IPATH/iTunes" <<-'EOF' | |
#!/bin/bash | |
PROCESS=$(ps aux | grep Ecoute | egrep -v "grep|Ecoute Helper") | |
if [ -z "$PROCESS" ] | |
then | |
"/Applications/iTunes.app/Contents/MacOS/iTunesX" & | |
disown %1 | |
fi | |
EOF | |
sudo chmod uog+x "$IPATH/iTunes" | |
else | |
echo "Already patched." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I modified it to also check if VLC is running.