Skip to content

Instantly share code, notes, and snippets.

@clintonpaquin
Created January 15, 2014 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clintonpaquin/8444713 to your computer and use it in GitHub Desktop.
Save clintonpaquin/8444713 to your computer and use it in GitHub Desktop.
#!/bin/bash
user=clinton.paquin
pass=$(security find-internet-password -w -a "$user" -s "accounts.google.com")
curl -u "$user:$pass" --silent "https://mail.google.com/mail/feed/atom"| perl -ne '
print "Subject: $1 " if /<title>(.+?)<\/title>/ && $title++;
print "(from $1)" if /<email>(.+?)<\/email>/;
' | terminal-notifier -title "Gmail" -sound default;
@ttscoff
Copy link

ttscoff commented Jan 15, 2014

I'm unclear what you're expecting this to do... notifications wrap on two lines and then cut off…

@clintonpaquin
Copy link
Author

Just wanted to force a line break between messages, so they weren't all piled into one long string on the notification.

@ttscoff
Copy link

ttscoff commented Jan 17, 2014

Can you even see multiple lines? I just get a 2-line notification that barely fits the first line in…

@clintonpaquin
Copy link
Author

@ttscoff

Yeah, if the subject is short enough (but I'm not seeing time stamps)

https://www.dropbox.com/s/4p46vr2y953oamc/Screenshot%202014-01-17%2012.20.59.png

@ttscoff
Copy link

ttscoff commented Jan 17, 2014

@clintonpaquin (I don't think these @ refs work in gist comments)

The time stamp is part of the subject in my case. I'm still confused where you want the line break… do you mean you want to cut off the subject and see the next one underneath it? You'd still only see two messages...

@clintonpaquin
Copy link
Author

in my case, I had 2 messages ... so yeah, you would only see 2. Let's say you had 5 ... then it would display as follows, each message on a new line (or line break between them so they don't string together)

Subject: Message from foo (from foo@foo.com)
Subject: Message from bar (from foo@bar.com)
Subject: Message from bat (from foo@bat.com)
Subject: Message from bazz (from foo@bazz.com)
Subject: Message from buzz (from foo@buzz.com)

@ttscoff
Copy link

ttscoff commented Jan 17, 2014

Looks like it's a moot point, either terminal-notifier or Notification Center appears to strip out all line breaks no matter how you format it.

@clintonpaquin
Copy link
Author

I guess that's the answer I was looking for ... I tried a bunch of options and didn't have any luck. Thanks for the time, really appreciated. Congrats on going out on your own BTW, I'm a paid subscriber :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment