Last active
August 29, 2015 14:21
-
-
Save vjm/1a873d0b7cd63cb4f8b7 to your computer and use it in GitHub Desktop.
Revisions
-
vjm revised this gist
May 19, 2015 . 2 changed files with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ `curl -s https://gist.github.com/vjm/1a873d0b7cd63cb4f8b7/raw/toggle_spotify.sh | bash` 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 charactersOriginal file line number Diff line number Diff line change @@ -18,5 +18,5 @@ if [ $exitCode == 0 ]; then 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.github.com/vjm/1a873d0b7cd63cb4f8b7/raw/toggle_spotify.sh | bash fi -
vjm created this gist
May 18, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ #!/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 ./$0 fi