Created
November 5, 2012 18:35
-
-
Save magnusdahlstrand/4019478 to your computer and use it in GitHub Desktop.
Rewrites the Adium sound preferences file to mute all sounds.
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/sh | |
# It's still a bit quick and dirty, and is only tested on Snow Leopard. | |
adium_sound_settings_path="/Users/$USER/Library/Application Support/Adium 2.0/Users/Default/Sounds.plist" | |
temp_file_path="/tmp/muteadium_tmp.xml" | |
if [ ! -r "$adium_sound_settings_path" -a ! -w "$adium_sound_settings_path" ]; then | |
echo "Unable to read/write settings file." | |
exit 1 | |
fi | |
plutil -convert xml1 -o "$temp_file_path" -- "$adium_sound_settings_path" | |
awk ' | |
BEGIN { FS = "[<|>]" } | |
{ | |
if ($2 == "real") { | |
sub($3, 0) | |
} | |
print > "/tmp/muteadium_tmp.xml" | |
} | |
' "$temp_file_path" | |
plutil -convert binary1 -o "$adium_sound_settings_path" -- "$temp_file_path" | |
rm "$temp_file_path" | |
killall Adium > /dev/null 2>&1 | |
if [[ $? -eq 0 ]]; then | |
/Applications/Adium.app/Contents/MacOS/Adium & | |
fi | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment