红联Linux门户
Linux帮助

Adium主题让你的Pidgin更美

发布时间:2015-03-18 10:48:02来源:linux网站作者:linux人

Pidgin用多了难免感觉它的chat窗口单调乏味,正好前几天体验Ubuntu时随便用了下Empathy,觉得它的chat主题挺新鲜(其实也不新鲜,只是Pidgin用太多了)。查了查原来是借用了adium的现成主题包。本打算就此转投empathy怀抱,但它的qq经常连不上很让人烦,还是只能老老实实用回pidgin。不过受empathy启发,折腾了一番把pidgin的chat也用adium主题包装,chatting感觉提升不少哦!

上图看看效果先
Adium主题让你的Pidgin更美

图片上传到红联Linux系统教程频道中。

这是adium的Noteboard主题,聊天文字更新时还有动画效果哦,赞一个!下面是详细配置过程,俺的桌面系统是Fedora。


第一步、安装必须的library

Ubuntu下要装的libray名字是pidgin, libnotify-bin, libpurple-dev, pidgin-dev, libwebkit-dev, bzr,F12下则是libnotify,libnotify-devel,pidgin-libnotify, libpurple, libpurple-devel, pidgin-devel, pywebkitgtk, webkitgtk, webkitgtk-devel, bzr;


第二步、生成adium-install.sh文件

文件内容如下,看了看比较短小精悍,学习ing...

#!/bin/bash 
# Adium theme AdiumMessageStyle installer for Empathy 
# Originally  Antono Vasiljev 
# Licensed under the same terms as Empathy 
# http://antono.info/en/165-install-adium-themes-to-empathy 
# Changed by Vertlo Oraerk (did not work with directories containing spaces in the names) 
# Changed by h!v from ubuntuforums to work with Pidgin+libwebkit and Notifications 
# On Ubuntu you need to install libwebkit and libnotify-bin to get it working properly 
# Further info on how to get working adium themes in Pidgin at http://www.webupd8.org/2009/05/pidgin-webkit-plugin-adium-conversation.html 
# 02-12-2010 - Support for Adium 1.0 sound themes added. Hooha! 
# Sound themes are supported in 2.6.x versions. If there's no file set for event, Pidgin falls to default sound file. 
#   IM 
#Message Sent = send_im 
#Message Received (New) = first_im_recv 
#Message Received = im_recv 
#   Chat 
#Message Sent = send_chat_msg - you send a message in a chat  
#Message Received (Group Chat) =  chat_msg_recv - someone else sends a message in a chat  
#You Are Mentioned = nick_said - someone says your username in a chat 
#   Status 
#Contact Signed On = login 
#Contact Signed Off = logoff 
#Contact Joins = join_chat - a person enters a chat  
#Contact Leaves = left_chat - a person leaves a chat
types[0]="<key>Message Sent</key>" 
types[1]="<key>Message Received (New)</key>" 
types[2]="<key>Message Received</key>" 
types[3]="<key>Message Sent</key>" 
types[4]="<key>Message Received (Group Chat)</key>" 
types[5]="<key>You Are Mentioned</key>" 
types[6]="<key>Contact Signed On</key>" 
types[7]="<key>Contact Signed Off</key>" 
types[8]="<key>Contact Joins</key>" 
types[9]="<key>Contact Leaves</key>" 
events[0]="im_sent" 
events[1]="first_im_recv" 
events[2]="im_recv" 
events[3]="send_chat_msg" 
events[4]="chat_msg_rec" 
events[5]="nick_said" 
events[6]="login" 
events[7]="logoff" 
events[8]="join_chat" 
events[9]="left_chat"
# Creating a file  
if [ -z $1 ]  
then  
echo  
echo "Usage:" 
echo "`basename $0` adiumxtra://some.url.here/extra" 
echo  
exit 1  
else 
TMPDIR=`mktemp -d`  
XTRAURL=`echo $1 | sed -e "s/^adiumxtra:/http:/"`  
DEST="$HOME/.purple/message_styles/" 

if [ ! -d $DEST ]  
then  
mkdir -v -p $DEST  
fi  
cd $TMPDIR  
notify-send "File this" \ "for Adium to be seems" --icon=pidgin  
wget --no-verbose -O xtra.zip $XTRAURL  
unzip -qq xtra.zip  
ls -d ./*.AdiumMessageStyle/ > themes_to_copy.lst  
ls -d ./*.AdiumSoundset/ > sound.lst  
num_bytes=`wc -c themes_to_copy.lst | sed 's# themes_to_copy.lst##'`
sound=`wc -c sound.lst | sed 's# sound.lst##'`
NAME=`cat themes_to_copy.lst | cut -f 2 --delimiter='.' | cut -f 2 --delimiter='/'`  
NAME_S=`cat sound.lst | cut -f 2 --delimiter='.' | cut -f 2 --delimiter='/'`  
if [ $num_bytes = 0 ]  
then  
if [ $sound = 0 ]  
then  
notify-send "All here I found" \ "gibberish was" --icon=pidgin  
else 
while read line_  
do 
if [ ! -d $line_/Sounds.plist ]  
then  
notify-send "Found I theme" \ " $NAME_S " --icon=pidgin  
DEST="$HOME/.purple/themes/$NAME_S/purple/sound/" 
if [ ! -d $DEST ]  
then  
mkdir -v -p $DEST  
fi 
# Creating a file  
touch theme.xml  
echo -e "<?xml version=\"1.0\" encoding=\"UTF-8\"?> ">> $line_/theme.xml  
echo -e "<theme type=\"sound\" name=\"$NAME_S\">" >> $line_/theme.xml  
while read line  
do 
if [ "$line" = "<key>Info</key>" ]  
then  
read line  
inf=`echo $line | sed -e "s/<string>//" | sed -e "s/<\/string>//"`  
echo -e "\t<description>$inf</description>" >> $line_/theme.xml  
fi  
for ((j=0; j<=9; j++))  
do 
if [ "$line" = "${types[j]}" ]  
then  
read line  
file=`echo $line | sed -e "s/<string>//" | sed -e "s/<\/string>//"`  
echo -e "\t<event name=\"${events[j]}\" file=\"$file\"/>" >> $line_/theme.xml  
fi
done  
done < $line_/Sounds.plist  
echo -e "</theme>" >> $line_/theme.xml  
echo cp -r \'$line_\'* $DEST | sh 
else 
notify-send "Use I force could" \ "none effect, that made" --icon=pidgin  
fi  
done < sound.lst  
fi  
else 
while read line
do 
echo cp -r \'$line\' "$DEST" | sh  
done < themes_to_copy.lst  
echo  
notify-send "Installed I" \ " $NAME for you " --icon=pidgin  
fi  
rm -r xtra.zip  
rm -r $TMPDIR  
fi  
exit 0


第三步、配置应用关联

假设adium-install.sh已放在/home/<username>/下,执行下列命令

[localhost ~]$ cd /home/<username>
[localhost ~]$ chmod 755 adium-install.sh
[localhost ~]$ gconftool-2 -t string -s /desktop/gnome/url-handlers/adiumxtra/command "/home/<username>/adium-install.sh %s"
[localhost ~]$ gconftool-2 -t bool -s /desktop/gnome/url-handlers/adiumxtra/enabled true
[localhost ~]$ gconftool-2 -t bool -s /desktop/gnome/url-handlers/adiumxtra/needs_terminal false


第四步、安装pidgin-webkit plugin with karmic fixes

终端中执行下列命令

[localhost ~]$ cd /home/<username>
[localhost ~]$ bzr branch lp:~spoidar/pidgin-webkit/karmic-fixes
[localhost ~]$ cd karmic-fixes
[localhost ~]$ make

如成功make,在/home/<username>/karmic-fixes/中会有webkit.so这个文件,copy此文件到/home/<username>/.purple/plugins目录下。


第五步、下载安装adium的主题

从http://www.adiumxtras.com/index.php?a=search&cat_id=5 下载adium 主题。如果此前的adium-install.sh配置正确,当点击主题页面中的“Install”后,该脚本会自动下载主题并安装到/home/<username>/.purple/message_styles中(notification area还会有相应提示),当然也可以自己下载主题后解压到message_styles目录。


第六步、在Pidgin中配置webkit插件

最后,在pidgin的Tools > Plugins中,选中 "Webkit message styles"插件,点击“Configure plugin”选择已下载的主题,大功告成!