Hi guys,
I've been using Gmail Notifr for some years now, I've gotten so used to having it installed, when it broke in 10.8 I realised my whole workflow came to a halt.
So I have an idea, and I'd like to enlist the help of some people familiar with Perl or just some general SSH to get a neat little plug-in / stop-gap.
My idea is to combine the awesome EnCee Notify proxy for Notification Center with any of the many clever shell scripts out there that check your Gmail inbox feed.
EnCee notify has the ability to imitate any application when displaying notifications, so these could even show up as Mail or a custom app of your choosing. The usage is really very simple:
And one shell script I really like for checking your inbox is made by Cristian Greco. The code is below, as it's pretty simple and seems like it's just one step away from working with ncnotify.
Now, this set up as a cronjob and some added functionality to prevent notifications for already seen emails, and voilà! I've already made many attempts but they all ruin the beauty and simplicity of the above code, I know it can be done simply, I just know it's over my head.
I've been using Gmail Notifr for some years now, I've gotten so used to having it installed, when it broke in 10.8 I realised my whole workflow came to a halt.
So I have an idea, and I'd like to enlist the help of some people familiar with Perl or just some general SSH to get a neat little plug-in / stop-gap.
My idea is to combine the awesome EnCee Notify proxy for Notification Center with any of the many clever shell scripts out there that check your Gmail inbox feed.
EnCee notify has the ability to imitate any application when displaying notifications, so these could even show up as Mail or a custom app of your choosing. The usage is really very simple:
Code:
ncnotify -t $sender -st $subject -m $excerpt -sn 'Tink' -im 'Mail'
And one shell script I really like for checking your inbox is made by Cristian Greco. The code is below, as it's pretty simple and seems like it's just one step away from working with ncnotify.
Code:
#!/bin/bash
## Change to your username and password - DO NOT ADD @GMAIL.COM
username="username"
password="password"
## Ensure that no parameters are passed to the script
[ $# -ne "0" ] && printf "USAGE: gmail" && exit 1
## Check if the necessary software is installed on the computer
for program in wget curl ; do
$program &>/dev/null
[ $? -eq "127" ] && printf "The program $program has not been installed on this computer!" && exit 1
done
## Ensure the user is connected to the Internet
ping -c 1 209.85.147.103 &>/dev/null
[ $? -eq "2" ] && printf "You must be connected to the Internet!" && exit 1
## Ensure the user has entered their username and password
[ "$username" == "username" ] && [ "$password" == "password" ] && printf "Please enter your username and password!" && exit 1
## Check if there are any new emails
atomlines=`wget -T 3 -t 1 -q --secure-protocol=TLSv1 --no-check-certificate --user=$username --password=$password https://mail.google.com/mail/feed/atom -O - | wc -l`
## If there are new emails then print them to STDIN
[ $atomlines -gt "8" ] && printf "You have new email!" && curl -u $username:$password --silent "https://mail.google.com/mail/feed/atom" | tr -d 'n' | awk -F '<entry>' '{for (i=2; i<=NF; i++) {print $i}}' | perl -pe 's/^<title>(.*)</title><summary>(.*)</summary>.*?<name>(.*?)</name>.*$/ From: $3Subject: $1Message: $2/' || printf "No new emails."
## Exit program successfully
exit 0
Now, this set up as a cronjob and some added functionality to prevent notifications for already seen emails, and voilà! I've already made many attempts but they all ruin the beauty and simplicity of the above code, I know it can be done simply, I just know it's over my head.