From 158883aba19b1dced08ad02cb87bd07cb90dfb0c Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Tue, 3 Feb 2015 13:58:25 +0800 Subject: Updated configs of offlineimap, msmtp. Added notmuch-config. --- .offlineimap/postsync.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 .offlineimap/postsync.sh (limited to '.offlineimap/postsync.sh') diff --git a/.offlineimap/postsync.sh b/.offlineimap/postsync.sh new file mode 100755 index 0000000..c5a3985 --- /dev/null +++ b/.offlineimap/postsync.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# +# OfflineIMAP postsynchook +# +# Weitian LI +# 2015/02/02 +# + +## Check new mails & send notification +MAILDIR="${HOME}/Mail/" +newmails=0 +for d in `find ${MAILDIR} -maxdepth 2 -type d -iname '*inbox'`; do + n=`ls ${d}/new/ | wc -l` + newmails=`expr ${newmails} + ${n}` +done + +if [ ${newmails} -gt 0 ] && which notify-send >/dev/null 2>&1; then + export DISPLAY=":0" + export XAUTHORITY="${HOME}/.Xauthority" + notify-send -i 'mail-unread' -a "OfflineIMAP" \ + "OfflineIMAP: Received ${newmails} new mail(s)!" +fi + +## Invoke notmuch to index mails +notmuch new + -- cgit v1.2.2