dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles
Log | Files | Refs | README | LICENSE Back to index

commit 198a8165672279dc77d9f2bc6cc020d86795cd00
parent abd78522ca96355ece2f3fdcf964dd628af6300f
Author: Anders Damsgaard Christensen <adc@geo.au.dk>
Date:   Thu,  2 Jun 2016 13:10:27 -0700

Merge branch 'master' of github.com:anders-dc/dotfiles

Diffstat:
Mbitbar-plugins/mail.5s.sh | 39+++++++++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/bitbar-plugins/mail.5s.sh b/bitbar-plugins/mail.5s.sh @@ -1,28 +1,55 @@ -#!/bin/sh +#!/bin/bash newmails=$(find ~/Mail/*/INBOX/new -type f) numbernewmails=$(echo $newmails | wc -w | sed 's/ *//') +mailboxes="$(echo $newmails | tr ' ' '\n' | sed 's/.*Mail\///' | sed 's/\/INBOX.*//')" + mailcolor="#859900" debug=false +#debug=true offlineimap=/usr/local/bin/offlineimap +accounts="" +if [[ $mailboxes == *"riseup"* ]]; then + accounts="${accounts}r" +fi +if [[ $mailboxes == *"geomail"* ]]; then + accounts="${accounts}a" +fi +if [[ $mailboxes == *"ucsd"* ]]; then + accounts="${accounts}u" +fi +if [[ $mailboxes == *"gmail"* ]]; then + accounts="${accounts}g" +fi + if [ "$numbernewmails" -gt 0 ]; then mailcolor="#cb4b16" + echo "M: ${numbernewmails} (${accounts}) | color=${mailcolor}" +else + echo "M: ${numbernewmails} | color=${mailcolor}" fi -echo "M: ${numbernewmails} | color=${mailcolor}" - # everything below in drop down menu echo "---" -mailboxes="$(echo $newmails | sed 's/.*Mail\///' | sed 's/\/INBOX.*//')" echo $mailboxes echo "---" -from="$(cat $newmails | grep 'From: ' | sed 's/From: //' | sed 's/>/>\\n/')" -echo $from +from="$(cat $newmails | grep 'From: ' | sed 's/From: //')" +printf "$from\n" echo "---" echo "Sync inboxes | bash=\"$offlineimap\" param1=-qf param2=INBOX terminal=$debug" echo "Sync all | bash=\"$offlineimap\" terminal=$debug" + + +if [[ $debug == "true" ]]; then + echo "---" + + echo "newmails: $newmails" + echo "numbernewmails: $numbernewmails" + echo "mailboxes: $mailboxes" +fi +