Create a gist now

Instantly share code, notes, and snippets.

Skype notifications using libnotify on Linux
#!/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"
@ndbroadbent
Owner

To download and execute this script, run the following in your terminal:

bash < <(curl -s https://raw.github.com/gist/2181122/skype-libnotify.sh)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment