curl -s https://gist.githubusercontent.com/vjm/1a873d0b7cd63cb4f8b7/raw/toggle_spotify.sh | bash
Last active
August 29, 2015 14:21
-
-
Save vjm/1a873d0b7cd63cb4f8b7 to your computer and use it in GitHub Desktop.
Toggle hiding spotify application icon visibility
This file contains 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 | |
val=$(/usr/libexec/PlistBuddy -c 'print ":NSUIElement"' /Applications/Spotify.app/Contents/Info.plist 2>/dev/null) | |
# Save the exit code, which indicates success v. failure | |
exitCode=$? | |
if [ $exitCode == 0 ]; then | |
toggled=$((val-1)) | |
negative_value=$((toggled < 0)) | |
if [ $negative_value ]; then | |
toggled=$((toggled*-1)) | |
fi | |
echo "0 means it will show the icon, 1 means hide it." | |
echo "currently $val" | |
echo "toggling to $toggled" | |
/usr/libexec/PlistBuddy -c "Set :NSUIElement $toggled" /Applications/Spotify.app/Contents/Info.plist | |
else | |
echo "element doesn't exist, creating value.." | |
/usr/libexec/PlistBuddy -c "Add :NSUIElement string '0'" /Applications/Spotify.app/Contents/Info.plist | |
curl -s https://gist.githubusercontent.com/vjm/1a873d0b7cd63cb4f8b7/raw/toggle_spotify.sh | bash | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment