Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Conky: Facebook Notifications

  1. #1
    Join Date
    Dec 2008
    Location
    127.0.0.1
    Beans
    187
    Distro
    Ubuntu Development Release

    Conky: Facebook Notifications

    (Not sure why this is marked as solved...but uh...)

    I was bored, and was looking for a way to easily get Facebook notifications on Ubuntu, since I always have my conky visible, I figured that was a good place to start.

    This requires fbcmd which is pretty easy to install, and I've found it to be rather useful.

    Decided to just combined it all into a single script, rather messy, but it works.
    Code:
    #!/bin/bash
    
    if [ "$1" = "message" ]
    then
    	msgcount=$(fbcmd NOTIFY | grep MESSAGES_UNREAD | grep -oE "[[:digit:]]{1,}")
    
    	if [ "$msgcount" -eq "0" ]
    	then
    		echo No New Messages
    
    	elif [ "$msgcount" -eq "1" ]
    	then
    		echo '${color white}'$msgcount'${color aaaaaa}' NEW MESSAGE
    	else
    
    		echo '${color white}'$msgcount'${color aaaaaa}' NEW MESSAGES
    	fi
    
    elif [ "$1" = "poke" ]
    then
    	pokecount=$(fbcmd NOTIFY | grep POKES | grep -oE "[[:digit:]]{1,}")
    
    	if [ "$pokecount" -eq "0" ]
    	then
    		echo No One Has Poked You
    
    	elif [ "$pokecount" -eq "1" ]
    	then
    		echo '${color white}'$pokecount'${color aaaaaa}' PERSON HAS POKED YOU
    	else
    
    		echo '${color white}'$pokecount'${color aaaaaa}' PEOPLE HAVE POKED YOU
    	fi
    
    elif [ "$1" = "notify" ]
    then
    	notifycount=$(fbcmd NOTICES unread | grep -c :title)
    
    	if [ "$notifycount" -eq "0" ]
    	then
    		echo No New Notifications
    
    	elif [ "$notifycount" -eq "1" ]
    	then
    		echo '${color white}'$notifycount'${color aaaaaa}' NEW NOTIFICATION
    	else
    
    		echo '${color white}'$notifycount'${color aaaaaa}' NEW NOTIFICATIONS
    	fi
    
    elif [ "$1" = "friend" ]
    then
    	friendcount=$(fbcmd NOTIFY | grep FRIEND_REQUESTS | grep -oE "[[:digit:]]{1,}")
    
    	if [ "$friendcount" -eq "0" ]
    	then
    		echo No New Friend Requests
    
    	elif [ "$friendcount" -eq "1" ]
    	then
    		echo '${color white}'$friendcount'${color aaaaaa}' NEW Friend Request
    	else
    
    		echo '${color white}'$friendcount'${color aaaaaa}' NEW Friend Requests
    	fi
    
    elif [ "$1" = "group" ]
    then
    	groupcount=$(fbcmd NOTICES unread | grep -c :title)
    
    	if [ "$groupcount" -eq "0" ]
    	then
    		echo No New Group Invites
    
    	elif [ "$groupcount" -eq "1" ]
    	then
    		echo '${color white}'$groupcount'${color aaaaaa}' NEW Group Invite
    	else
    
    		echo '${color white}'$groupcount'${color aaaaaa}' NEW Group Invites
    	fi
    
    elif [ "$1" = "events" ]
    then
    	eventscount=$(fbcmd NOTICES unread | grep -c :title)
    
    	if [ "$eventscount" -eq "0" ]
    	then
    		echo No New Events
    
    	elif [ "$eventscount" -eq "1" ]
    	then
    		echo '${color white}'$eventscount'${color aaaaaa}' NEW Event
    	else
    
    		echo '${color white}'$eventscount'${color aaaaaa}' NEW Events
    	fi
    
    else
    	echo "Please state a command, [message,poke,notify,friend,group,events]"
    fi
    Simple script, but I felt like sharing them anyway.

    Add to your conky like so...
    Code:
    ${color white} $alignr FACEBOOK
    ${color aaaaaa} $alignr ${execpi 15 ~/.scripts/facebook notify}
    ${color aaaaaa} $alignr ${execpi 15 ~/.scripts/facebook poke}
    ${color aaaaaa} $alignr ${execpi 15 ~/.scripts/facebook message}
    ${color aaaaaa} $alignr ${execpi 15 ~/.scripts/facebook friend}
    ${color aaaaaa} $alignr ${execpi 15 ~/.scripts/facebook group}
    ${color aaaaaa} $alignr ${execpi 15 ~/.scripts/facebook events}
    ...and you're good.
    Attached Images Attached Images
    Last edited by dmillerw; September 27th, 2010 at 02:19 PM.

  2. #2
    pwnst*r is offline Gee! These Aren't Roasted!
    Join Date
    Mar 2009
    Beans
    Hidden!

    Re: Conky: Facebook Notifications

    Good stuff, thanks!

  3. #3
    Join Date
    Mar 2009
    Location
    Northern Alberta, Canada
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Conky: Facebook Notifications

    I realize I could probably find this by wading through the Conky mega-thread, but what kind of script are you using for displaying the computer names & IP addresses of your local network? I think I'd like to try something similar.
    I'd rather have a bottle in front of me, than a frontal lobotomy!

  4. #4
    Join Date
    Dec 2008
    Location
    127.0.0.1
    Beans
    187
    Distro
    Ubuntu Development Release

    Re: Conky: Facebook Notifications

    Quote Originally Posted by spillin_dylan View Post
    I realize I could probably find this by wading through the Conky mega-thread, but what kind of script are you using for displaying the computer names & IP addresses of your local network? I think I'd like to try something similar.
    Code:
    #!/bin/bash
    if ping -c1 -W1 $1> /dev/null; then
    echo '${color white} $alignr '$2 - '${color aaaaaa} ONLINE ${color}'
    echo '${color white} $alignr '$1'${color}'
    else
    echo '${color white} $alignr '$2 - '${color aaaaaa} OFFLINE ${color}'
    echo '${color white} $alignr '$1'${color}'
    fi
    It's nothing special, but there you go...format is IP then Name

    Code:
    ./ping.sh [IP] [NAME]
    Last edited by dmillerw; September 4th, 2010 at 02:41 AM.

  5. #5
    Join Date
    Mar 2009
    Location
    Northern Alberta, Canada
    Beans
    109
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Conky: Facebook Notifications

    Oh, you're just pinging a preset list! I thought there was some way you were actually getting a list of what is online at any given time. Like, for instance, what you see on a router configuration page. I guess as long as the computer's IP doesn't change on your network, then this should work good, too.

    But thanks for the swift reply!
    I'd rather have a bottle in front of me, than a frontal lobotomy!

  6. #6
    Join Date
    Dec 2008
    Location
    127.0.0.1
    Beans
    187
    Distro
    Ubuntu Development Release

    Re: Conky: Facebook Notifications

    Quote Originally Posted by spillin_dylan View Post
    Oh, you're just pinging a preset list! I thought there was some way you were actually getting a list of what is online at any given time. Like, for instance, what you see on a router configuration page. I guess as long as the computer's IP doesn't change on your network, then this should work good, too.

    But thanks for the swift reply!
    I actually hadn't thought of doing it that way...might have to look into that, but you're welcome.

  7. #7
    Join Date
    Apr 2007
    Location
    New York
    Beans
    135
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Conky: Facebook Notifications

    Will this handle Requests and Invitations?
    Last edited by castironpants; September 21st, 2010 at 09:11 PM.

  8. #8
    Join Date
    Nov 2007
    Location
    England
    Beans
    731
    Distro
    Ubuntu 11.10 Oneiric Ocelot

    Re: Conky: Facebook Notifications

    I have never or ever want to be poked digitally!
    But nice script anyway.
    Want an alternative to 99% of Windows applications?
    http://www.osalt.com/

    "Dude, real programmers compile" - Plato 428BC

  9. #9
    Join Date
    Dec 2008
    Location
    127.0.0.1
    Beans
    187
    Distro
    Ubuntu Development Release

    Re: Conky: Facebook Notifications

    Just bringing this back up (if I'm allowed to do so, that is)

  10. #10
    Join Date
    Jan 2008
    Location
    Ticosland
    Beans
    3

    Re: Conky: Facebook Notifications

    Like a charm ! Thanx
    William

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •