About Me

header ads

Conky: Get Facebook notifications on Linux [Script]

I love trying scripts in Conky, is simply, is a great system monitor!

For those unfamiliar with Conky, I suggest you google a bit of info, you'll see that lots of sites (I do not recommend this one) and also find it very simple to use and configure, but at the same time is very striking.

Well, let's get to work!

1) create, in our personal folder, an empty file called "facebook". It will write the script, so those who already use a folder for these files, While there, they could create.

2) Paste in the file listed as follows:
  • #!/bin/bash
  • numberoflines=5
  • address="REPLACE_WITH_YOUR_LINK_FB_Notifier"
  • 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>.*/,"")
  •  print }' | grep "" | cut -d"<" -f2 | cut -d">" -f2 | awk '{
  •  gsub(/&apos;s/, "");
  •  gsub(/&quot;/, "\"");
  •  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
  •     print
  •     stored_lines[$0]=1
  •  }'| tail -n +2 | head -n $numberoflines
  • rm -f /tmp/fbrss*
The value of "numberoflines"We will tell you how many notifications. Modify this parameter to taste.

3) Now we must open our notifications page FB (Of course you have to be logged on the network for this.) Easy to get to the page, make click here.

You see, there is an option that is "By RSS". Copy this link and paste it into script, where it says "REPLACE_WITH_YOUR_LINK_FB_Notifier"


4) We make the script executable:

  • chmod + x ~ / facebook
Do not forget to change the parameter if they have saved the file in another location.

5) Finally, simply change our archive. Conkyrc with the following:
  • $ {If_existing / proc / net / route eth0} $ {font Ubuntu: size = 12}} $ {Color4 Facebook notifications: $ {color}
  • $ {Hr 2}
  • $ {Voffset -2} $ {font Ubuntu: size = 10} $ {color1} $ {execi 60 ~ / facebook} $ {color white}
  • $ {Endif}
Now, save the changes and ready! Notifications on Facebook integrated Conky and a very simple way.


I hope you enjoy and you find it useful.

Greetings!

Post a Comment

0 Comments