Skip to content

Instantly share code, notes, and snippets.

@ndbroadbent
Created March 24, 2012 11:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ndbroadbent/2181122 to your computer and use it in GitHub Desktop.
Save ndbroadbent/2181122 to your computer and use it in GitHub Desktop.
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
Copy link
Author

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