Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- settings=$HOME/Launchers/.tconk-settings-general
- # set cookies file
- . $settings
- # make sure that the above file location contains your facebook cookies. I used the firefox extension 'Export Cookies' available at:
- # https://addons.mozilla.org/en-us/firefox/addon/export-cookies/
- # save the cookies file somewhere, then extract your facebook cookies. this is what I did (inside my Launchers folder, where all of my conky files are):
- # grep ^.facebook.com cookies.txt > .tconk-settings-fbCookies; rm cookies.txt
- fbFullString=$(wget --load-cookies="$cookiesFile" -O - m.facebook.com)
- fbLoggedIn=$(echo "$fbFullString" | grep -iE 'accesskey="4">' | grep -i notifications | grep -o '4')
- fbMessageCount=$(echo "$fbFullString" | grep -ioE 'messages\([0-9]+\)' | grep -oE '[0-9]+' | uniq)
- fbFriendRequestCount=$(echo "$fbFullString" | grep -ioE 'find friends\([0-9]+\)' | grep -oE '[0-9]+')
- fbNotificationsCount=$(echo "$fbFullString" | grep -ioE 'notifications\([0-9]+\)' | grep -oE '[0-9]+')
- if [ -n "$fbLoggedIn" ]; then
- if [ -n "$fbMessageCount" ] && [ "$fbMessageCount" -gt 0 ]; then
- echo "M$fbMessageCount" > "$tmpfolder"/time-fb
- elif [ -n "$fbNotificationsCount" ]; then
- echo "$fbNotificationsCount" > "$tmpfolder"/time-fb
- elif [ -n "$fbFriendRequestCount" ]; then
- echo "F$fbFriendRequestCount" > "$tmpfolder"/time-fb
- else
- echo 0 > "$tmpfolder"/time-fb
- fi
- else
- echo > "$tmpfolder"/time-fb
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement