From b28f58b7804b77af32343732a8651ff8c487ea04 Mon Sep 17 00:00:00 2001 From: Urbain Vaes Date: Sat, 23 Jan 2016 17:35:07 +0000 Subject: Update mr --- bin/email | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/email b/bin/email index 4261366..84e923e 100755 --- a/bin/email +++ b/bin/email @@ -1,6 +1,16 @@ #! /usr/bin/env bash + +# Necessary to see the notification export DISPLAY=:0 + +# Get all emails mbsync -a -nmails=$(find $HOME/.mail -path '*/new/*' -type f | wc -l) -[[ nmails -ge 1 ]] && /usr/bin/notify-send -t 1 "New mail!" || /usr/bin/notify-send -u low -t 1 "No new mail!" + +new_mails=$(find $HOME/.mail -path '*/new/*' -type f) +subjects=$(cat $(echo -e ${new_mails/'\n'/' '}) | grep "^Subject: " | sed "s/^Subject: //g") + +if [[ ! -z ${new_mails} ]]; then + /usr/bin/notify-send -t 3 "New mail(s)!" "${subjects}" +fi + echo "Email last checked on $(date)". -- cgit v1.2.3