Created
May 24, 2011 00:17
-
-
Save frangio/987921 to your computer and use it in GitHub Desktop.
Checks Gmail and shows a Growl notification (using growlnotify) with unread count.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env ruby | |
begin | |
response = %x{ curl -u username:password --silent "https://mail.google.com/mail/feed/atom" } | |
fullcount = response.match(/<fullcount>(\d+)<\/fullcount>/)[1].to_i | |
message = fullcount > 0 ? fullcount.to_s + " new message(s)." : "No new messages." | |
rescue | |
message = "There was an error." | |
ensure | |
%x{ growlnotify "#{message}" -m "" --image "icon.png" } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment