diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2020-04-17 10:21:59 -0400 | 
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2020-04-17 10:21:59 -0400 | 
| commit | 946abe8f5fc97524cb58b8049bf2b37e71f55901 (patch) | |
| tree | 26796914d3677294510f129ebeceb12cf00e0e5f /bin/mailsync | |
| parent | 50f227b4535ecd4b13b122ace7872468fa1ddc65 (diff) | |
new mail info for macos
Diffstat (limited to 'bin/mailsync')
| -rwxr-xr-x | bin/mailsync | 4 | 
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/mailsync b/bin/mailsync index 32c0825..fc35ede 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -21,8 +21,10 @@ export DISPLAY=:0.0  # Settings are different for MacOS (Darwin) systems.  if [ "$(uname)" = "Darwin" ]; then      notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} +    messageinfo() { osascript "display notification with title \"📧 $from\" subtitle \"$subject\"" ;}  else      notify() { notify-send --app-name="mutt-wizard" "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} +    messageinfo() { notify-send --app-name="mutt-wizard" "📧$from:" "$subject" ;}  fi  # Check account for new mail. Notify if there is new content. @@ -37,7 +39,7 @@ syncandnotify() {              # Extract subject and sender from mail.              from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')              subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') -            notify-send --app-name="mutt-wizard" "📧$from:" "$subject" & +	    messageinfo &          done      fi  }  | 
