Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Benji Bee Tech

macrumors newbie
Original poster
Dec 20, 2011
5
0
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:

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.

:)
 

Mal

macrumors 603
Jan 6, 2002
6,252
18
Orlando
Gmail supports Mountain Lion's Notification Center natively. Just go into the settings on the Gmail site (in Safari) and turn on Desktop Notifications.

jW
 

bp1000

macrumors 65816
Jul 7, 2011
1,476
185
Just wish safari would support multiple accounts. My 3rd account sign in always gets stuck loading.
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
Gmail supports Mountain Lion's Notification Center natively. Just go into the settings on the Gmail site (in Safari) and turn on Desktop Notifications.

jW

How come it doesn't work for me? I turned on desktop notification in Gmail, however I don't get any notifications. I am running ML 10.8.1 and Gmail opened in Safari.
 

thasan

macrumors 65816
Oct 19, 2007
1,104
1,031
Germany
How come it doesn't work for me? I turned on desktop notification in Gmail, however I don't get any notifications. I am running ML 10.8.1 and Gmail opened in Safari.

doesnt work for me too. do u have to keep gmail open in browser or something?
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
One of the solution if Mailtab for Gmail for free from appstore. It shows notifications properly and is kind of better replacement for Gmail notifier.
 

Arizor

macrumors member
Aug 24, 2012
61
11
Slap me if I'm being stupid but can't you just add your gmail account to Mail and have new mail appear in notifications?

That's what I have, and all my new gmail is listed in notifications.
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
Slap me if I'm being stupid but can't you just add your gmail account to Mail and have new mail appear in notifications?

That's what I have, and all my new gmail is listed in notifications.

This is a solution of course, but you need to have Mail keep running which you don't want to use at all.
 

dusk007

macrumors 68040
Dec 5, 2009
3,411
104
This is a solution of course, but you need to have Mail keep running which you don't want to use at all.
Why not just use Mail? Works offline, fast, responsive.
Much more comfortable in handling multiple accounts.

I never understood why some people use webmail.
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
Why not just use Mail? Works offline, fast, responsive.
Much more comfortable in handling multiple accounts.

I never understood why some people use webmail.

Because Gmail with Mail doesn't work properly. When you delete email in Mail using Gmail IMAP it actually archives it, instead of deleting.
 

oneMadRssn

macrumors 603
Sep 8, 2011
5,983
14,017
NC is worthless….and bad idea….don't you agree? :apple:

I agree. I think they should have ported all the widgets to the notification center UI, and allowed devs to make app store apps that take advantage of the NC space.

FWIW, Gmail + Chrome also works with notification center. Chat notifications get pushed through as well as new mail notifications. I have gmail open nearly all the time, so it's decent for me.
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
I agree. I think they should have ported all the widgets to the notification center UI, and allowed devs to make app store apps that take advantage of the NC space.

FWIW, Gmail + Chrome also works with notification center. Chat notifications get pushed through as well as new mail notifications. I have gmail open nearly all the time, so it's decent for me.

Gmail web based + Chrome with desktop notifications push ML notifications for new emails / chat having Mail not running? Are you kidding? It doesn't work for me in either Safari or Chrome. New email arrives through web based Gmail but no notifications at all.
 

thasan

macrumors 65816
Oct 19, 2007
1,104
1,031
Germany
Why not just use Mail? Works offline, fast, responsive.
Much more comfortable in handling multiple accounts.

I never understood why some people use webmail.

i tried to use gmail in mail. not really very good IMO (and very messy!). maybe down to my personal choice.

----------

NC is worthless….and bad idea….don't you agree? :apple:

i disagree :) i quite like it. wish it had an option to responding (or at least, deleting) emails from the NC directly.
 

tarryweather

macrumors member
Jul 26, 2012
53
0
Because Gmail with Mail doesn't work properly. When you delete email in Mail using Gmail IMAP it actually archives it, instead of deleting.

Depends how you set it up. Personally, I want it to archive it, so I don't even have it sent to a local trash folder. But it you want deleting it to send it to Gmail's Trash, where it will be removed from the archive and permanently deleted after 30 days, all you have to do it map Gmail's trash folder to match Mail's. Highlight Gmail's "Trash" folder, then in the menu bar, click "Mailbox" -> "Use This Mailbox For" -> "Trash". Trust me, it works, I used it that way for years before I started actually using the "All Mail" folder and archiving.

The only messiness of this is that unless you're also deleting your sent messages, you end up with an "All Mail" folder full of old sent messages.
 

Attachments

  • Screen Shot 2012-08-30 at 8.01.13 AM.png
    Screen Shot 2012-08-30 at 8.01.13 AM.png
    14 KB · Views: 7,223
  • Screen Shot 2012-08-30 at 8.01.28 AM.png
    Screen Shot 2012-08-30 at 8.01.28 AM.png
    122.8 KB · Views: 166

oneMadRssn

macrumors 603
Sep 8, 2011
5,983
14,017
Gmail web based + Chrome with desktop notifications push ML notifications for new emails / chat having Mail not running? Are you kidding? It doesn't work for me in either Safari or Chrome. New email arrives through web based Gmail but no notifications at all.

I'm not using Mail.app at all. If you have "desktop notifications" enabled in gmail settings, and gmail is open in a tab in chrome, then it will push notifications to the ML NC.
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
[...)
But it you want deleting it to send it to Gmail's Trash, where it will be removed from the archive and permanently deleted after 30 days, all you have to do it map Gmail's trash folder to match Mail's. Highlight Gmail's "Trash" folder, then in the menu bar, click "Mailbox" -> "Use This Mailbox For" -> "Trash". Trust me, it works, I used it that way for years before I started actually using the "All Mail" folder and archiving.
[...]

Ok but I don't want to sacrifice "Archive" functionality either.

I'm not using Mail.app at all. If you have "desktop notifications" enabled in gmail settings, and gmail is open in a tab in chrome, then it will push notifications to the ML NC.

It doesn't work for me ML 10.8.1 running latest Chrome beta.
 

tarryweather

macrumors member
Jul 26, 2012
53
0
Ok but I don't want to sacrifice "Archive" functionality either.

So here's whatcha do:

  1. DON'T map Gmail's Trash icon to Mail.app's trash as shown above.
  2. In "Mailbox Behaviors" for your account, uncheck "Move deleted messages to the Trash mailbox".
  3. When you want to archive something, simply hit delete from your inbox or wherever, as you normally would. That will now just remove the message from that folder (label), but have to effect on it in other folders/labels, including the "All Mail" folder. Effectively, this means Mail's "Delete" button is now an "Archive" button.
  4. When you actually DO want to permanently delete something, instead of hitting delete, manually move it to Gmail's Trash folder.

This is how I use it, I can verify that it works.

Also, make sure this option is selected in Gmail:

Screen Shot 2012-08-31 at 7.43.58 AM.png
 

Benji Bee Tech

macrumors newbie
Original poster
Dec 20, 2011
5
0
Err, some constructive ideas guys, but not really on topic.

Yes, I know I can use Mail.app, but I don't want to. For a lot of the above reasons and more, such as Google Docs, Google Voice & Video, Google Phone, and some lab features I use quite often.

Yes, I can use Desktop Notifications, but I also don't want to. I don't want to leave a tab open with Gmail running, I do that now and can see from the favicon if I have new mail.

What I am asking for is some really simple help editing a shell script. I know for some Perl programmer out there, or anyone more experienced than me in Shell scripting (not hard to do) this would be a fifteen minute write-up and a useful tool for many.

Having a little cronjob running in the background taking up no memory or CPU and just giving me a little heads up when something important comes my way would be amazing, no?
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
So here's whatcha do:

  1. DON'T map Gmail's Trash icon to Mail.app's trash as shown above.
  2. In "Mailbox Behaviors" for your account, uncheck "Move deleted messages to the Trash mailbox".
  3. When you want to archive something, simply hit delete from your inbox or wherever, as you normally would. That will now just remove the message from that folder (label), but have to effect on it in other folders/labels, including the "All Mail" folder. Effectively, this means Mail's "Delete" button is now an "Archive" button.
  4. When you actually DO want to permanently delete something, instead of hitting delete, manually move it to Gmail's Trash folder.

This is how I use it, I can verify that it works.

Also, make sure this option is selected in Gmail:

Yes, but it is still a middle solution and rather inconvenient. What should I use Mail if web based Gmail is simply amazing?
- I have archive & delete buttons, so no manual moving anywhere
- Reply all by default (plugin)
- send & archive button (plugin)
- select text and hit reply just to quote selected text (plugin)

Gmail web based save me so much time that I don't have to think about the manual steps you are suggesting.

[...]
What I am asking for is some really simple help editing a shell script. I know for some Perl programmer out there, or anyone more experienced than me in Shell scripting (not hard to do) this would be a fifteen minute write-up and a useful tool for many.

Having a little cronjob running in the background taking up no memory or CPU and just giving me a little heads up when something important comes my way would be amazing, no?

Try Mailtab for Gmail free from appstore. It does what you ask for and even more as you can access, read and reply to emails without having to open Gmail in your browser.
 

tarryweather

macrumors member
Jul 26, 2012
53
0
Yes, but it is still a middle solution and rather inconvenient. What should I use Mail if web based Gmail is simply amazing?
- I have archive & delete buttons, so no manual moving anywhere
- Reply all by default (plugin)
- send & archive button (plugin)
- select text and hit reply just to quote selected text (plugin)

Gmail web based save me so much time that I don't have to think about the manual steps you are suggesting.



Try Mailtab for Gmail free from appstore. It does what you ask for and even more as you can access, read and reply to emails without having to open Gmail in your browser.

Diff'rent strokes! Personally, I prefer desktop clients to having everything living in the browser, and I specifically prefer Mail.app to Gmail's web interface. Aside from the setup, my process only has one manual step, and I never permanently delete anything anyway, so I don't ever have to take an extra manual step.

Also, with regard to:

- select text and hit reply just to quote selected text (plugin)

Mail.app does this by default too.
 

kgingeri

macrumors newbie
Nov 3, 2010
7
0
off topic - but had to chime in

As for running mail clients...

They have always been a source of maintenance and user disruption for me. whether Mac or Windows or whatever. Web mail "just works" - let me see, who used to say that a lot again? :rolleyes: :apple: ...

Anyway, more 2 cents worth (and for sure some users prefer a mail client, I now refuse to support it), EVEN OSX has shown to slow down for my users, who have used the mail client. Especially when not maintaining their mailboxes properly - i.e. archiving and/or deleting trash.
I have all my users running web mail and I never have a maintenance issue - only training :D

Regardless... and back on topic... I too, like the OP, would like reliable ML NC working for web mail. We use Chrome as well and it is always open.
 

stiwi

macrumors 6502
Nov 13, 2010
279
50
Dubai
This may sounds funny but after installing Adobe Flash Player standalone version, Gmail web based notifications started to show up in NC :confused:

At least in Chrome, didn't check in Safari yet.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.