Install Adium themes to Empathy

Tue Sep 22 22:44:19 UTC 2009 [ Русский | English ]
     #!/bin/sh
     # Adium theme AdiumMessageStyle installer for Empathy
     # Last version here: http://gist.github.com/191499

     if [ -z $1 ]
       then
     	echo
     	echo "	Usage:"
     	echo "		`basename $0` adiumxtra://some.url.here/extra"
     	echo
     	exit 1
     else
     	TMPDIR=`mktemp --directory`
     	XTRAURL=`echo $1 | sed -e "s/^adiumxtra:/http:/"`
     	DEST="$HOME/.local/share/adium/message-styles/"
     	if [ !-d $DEST ]
     	then
     		mkdir -v -p $DEST
     	fi
     
     	cd $TMPDIR
     	echo "Downloding extra..."
     	wget --no-verbose --progress=bar:force -O xtra.zip $XTRAURL
     	unzip -qq xtra.zip
     
     	THEMES=`ls -d *.AdiumMessageStyle/`
     
     	if [ -z $THEMES ]
     	then
     		echo "No themes found in downloaded file"
     	else
     		for theme in $THEMES
     		do
     			cp -r $theme $DEST
     		done
     		echo "\nTheme $XTRAURL was succesfully installed to $DEST"
     	fi
     	rm xtra.zip
     	rm -r $TMPDIR
     fi
     exit 0

Use gconf to enable this protocol handler for clever browsers:

gconftool-2 -t string -s /desktop/gnome/url-handlers/adiumxtra/command "/usr/loca/bin/adiumxtra-install %s"
gconftool-2 -t bool -s /desktop/gnome/url-handlers/adiumxtra/enabled true
gconftool-2 -t bool -s /desktop/gnome/url-handlers/adiumxtra/needs_terminal false

Works at least in Chromium :)

In a clean karmic beta installation there were two blocking bugs to install a theme. 1. if ! -d $DEST this leads to error : 42: !-d: unexpected operator to fix it you must add a space between ! and -d “if ! -d $DEST

  1. If you tried to install a theme which contains a space in its name like this http://adiumxtras.com/index.php?a=xtras&xtra_id=4987 things will go crazy! errors like this : 42: Adium: unexpected operator cp: cannot stat Adium': No such file or directory cp: cannot stat Matte.AdiumMessageStyle/’: No such file or directory

To fix it enclose $THEME in double quotes like this: if -z “$THEMES” then echo “No themes found in downloaded file” else for theme in “$THEMES”

btw it works just fine on firefox 3.5 too! Ty!! :D

Login with OpenID or Gmail to publish comments.