Created
March 24, 2012 11:03
-
-
Save ndbroadbent/2181122 to your computer and use it in GitHub Desktop.
Skype notifications using libnotify on Linux
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 | |
if [ "$1" = "--help" ]; then | |
echo "Usage: $0 <skype username> (if omitted, will detect default username)" | |
exit 1 | |
fi | |
if [ -n "$1" ]; then | |
# skype username from arg | |
skype_username="$1" | |
else | |
# Find default skype username from skype config | |
skype_username="$(grep "<Default>" "$HOME/.Skype/shared.xml" | sed "s/.*>\([^)]*\)<.*/\1/")" | |
if [ -z "$skype_username" ]; then | |
echo "Default Skype username not found." | |
exit 1 | |
fi | |
fi | |
config_file="$HOME/.Skype/$skype_username/config.xml" | |
echo "Fetching Skype libnotify config from github..." | |
curl -sL https://raw.github.com/ndbroadbent/dotfiles/master/skype/skype-UI.xml > /tmp/skype-UI.xml | |
echo "Setting up Skype libnotify notifications for $skype_username..." | |
tmp_file=$(mktemp) | |
# Replace <UI> key from existing config with saved config | |
sed -n '1h; 1!H; ${ g; s%\n\s*<UI>.*</UI>%% p }' "$config_file" | \ | |
sed -e "/<\/Lib>/r /tmp/skype-UI.xml" > "$tmp_file" | |
mv "$tmp_file" "$config_file" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To download and execute this script, run the following in your terminal: