Skip to content

Instantly share code, notes, and snippets.

@KaiSmith
Created August 22, 2012 06:30
Show Gist options
  • Save KaiSmith/3422932 to your computer and use it in GitHub Desktop.
Save KaiSmith/3422932 to your computer and use it in GitHub Desktop.
Creates a notification bubble when you receive a Facebook message.
#!/usr/bin/bash
#Dependencies: fbcmd
#Only tested for version 1.x
#Make sure to create file ~/Documents/LatestMessage.txt first
#Very useful to set as a program to run on startup
#!/usr/bin/bash
while true; do
in=`fbcmd inbox unread | grep ':' | head -n 2`
if [ "$in" != "`head ~/Documents/LatestMessage.txt`" ] && [ "$in" != "" ]; then
from=$(echo $in | awk '{print "New Meassage From",$2,$3}')
snip=`echo "$in" | tail -n 1 | sed -e 's/\s*:*snippet:*\s*//'`
echo "$in">~/Documents/LatestMessage.txt
notify-send -i ~/Pictures/facebook_logo.png "$from" "$snip"
fi
sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment