De data asta, Facebook Notifications :)
In mod normal, conky stie RSS, insa pentru facebook e necesara o oarecare formatare, altfel se umple ecranul inutil.
Ce avem de facut?
Fiecare cont de facebook are asociat un ID, cu ajutorul caruia putem prelua datele.
Ca sa obtinem ID-ul, mergem in cont, la http://www.facebook.com/notifications.php si copiem link-ul catre "Via RSS" ca in imagini si inlocuim in script REPLACE_WITH_URL
Bun. Deschidem gedit si dam copy/paste asta:
#!/bin/bashUnde numarlinii reprezinta cate notificari vrem sa se afiseze.
numarlinii=5
address="REPLACE_WITH_URL"
wget --user-agent="Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.55 Safari/533.4" -q $address -O /tmp/fbrss
cat /tmp/fbrss | awk '{
gsub(/.*<description>|<\/description>.*/,"")
print }' | grep "<title>" | cut -d"<" -f2 | cut -d">" -f2 | awk '{
gsub(/'s/, "");
gsub(/commented on/, ">");
gsub(/also/, "");
gsub(/your friend request/, "friendship");
gsub(/posted something on/, "-->");
gsub(/posted on/, "-->");
print }' | awk '{
if ($0 in stored_lines)
x=1
else
stored_lines[$0]=1
}'| tail -n +2 | head -n $numarlinii
rm -f /tmp/fbrss*
Salvam ca ~/bin/facebook si ii dam drepturi de executie cu chmod +x ~/bin/facebook
Deschidem .conkyrc adaugam si salvam:
${if_existing /proc/net/route eth0}${font Ubuntu:size=8}${color4}Facebook Notifications: ${color}
$stippled_hr
${voffset -2}${font Ubuntu:size=7}${color1}${execi 60 ~/bin/facebook}${color white}
${endif}
0 comentarii:
Trimiteți un comentariu