Gmail and Notification Center

Discussion in 'OS X Mountain Lion (10.8)' started by Benji Bee Tech, Aug 22, 2012.

  1. Benji Bee Tech macrumors newbie

    Joined:
    Dec 20, 2011
    #1
    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.

    :)
     
  2. Mal macrumors 603

    Mal

    Joined:
    Jan 6, 2002
    Location:
    Orlando
    #2
    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
     
  3. bp1000 macrumors 65816

    Joined:
    Jul 7, 2011
    #3
    Just wish safari would support multiple accounts. My 3rd account sign in always gets stuck loading.
     
  4. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #4
    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.
     
  5. thasan macrumors 6502a

    Joined:
    Oct 19, 2007
    Location:
    uk
    #5
    doesnt work for me too. do u have to keep gmail open in browser or something?
     
  6. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #6
    I am sure you need to keep it open in browser but despite I do that, notifications are not shown (web based Gmail usage).
     
  7. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #7
    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.
     
  8. thasan macrumors 6502a

    Joined:
    Oct 19, 2007
    Location:
    uk
    #8
    Not much useful for me then :( I was hoping direct notification. Never mind :)
     
  9. Arizor macrumors member

    Joined:
    Aug 24, 2012
    #9
    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.
     
  10. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #10
    This is a solution of course, but you need to have Mail keep running which you don't want to use at all.
     
  11. Badrottie Suspended

    Badrottie

    Joined:
    May 8, 2011
    Location:
    Los Angeles
    #11
    NC is worthless….and bad idea….don't you agree? :apple:
     
  12. dusk007 macrumors 68040

    dusk007

    Joined:
    Dec 5, 2009
    #12
    Why not just use Mail? Works offline, fast, responsive.
    Much more comfortable in handling multiple accounts.

    I never understood why some people use webmail.
     
  13. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #13
    Because Gmail with Mail doesn't work properly. When you delete email in Mail using Gmail IMAP it actually archives it, instead of deleting.
     
  14. oneMadRssn macrumors 68040

    oneMadRssn

    Joined:
    Sep 8, 2011
    Location:
    Boston, MA
    #14
    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.
     
  15. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #15
    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.
     
  16. thasan macrumors 6502a

    Joined:
    Oct 19, 2007
    Location:
    uk
    #16
    i tried to use gmail in mail. not really very good IMO (and very messy!). maybe down to my personal choice.

    ----------

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

    Joined:
    Jul 26, 2012
    #17
    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.
     

    Attached Files:

  18. oneMadRssn macrumors 68040

    oneMadRssn

    Joined:
    Sep 8, 2011
    Location:
    Boston, MA
    #18
    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.
     
  19. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #19
    Ok but I don't want to sacrifice "Archive" functionality either.

    It doesn't work for me ML 10.8.1 running latest Chrome beta.
     
  20. tarryweather macrumors member

    Joined:
    Jul 26, 2012
    #20
    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
     
  21. Benji Bee Tech thread starter macrumors newbie

    Joined:
    Dec 20, 2011
    #21
    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?
     
  22. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #22
    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.
     
  23. tarryweather macrumors member

    Joined:
    Jul 26, 2012
    #23
    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:

    Mail.app does this by default too.
     
  24. kgingeri macrumors newbie

    Joined:
    Nov 3, 2010
    #24
    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.
     
  25. stiwi macrumors regular

    Joined:
    Nov 13, 2010
    Location:
    Singapore
    #25
    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.
     

Share This Page