summaryrefslogtreecommitdiff
path: root/sync-mail
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-04-02 23:04:13 +0200
committerPatrick Simianer <p@simianer.de>2017-04-02 23:04:13 +0200
commitc5589d1625c26489b7a26f2bdab06b5a05513107 (patch)
treed023879b13dc8aa911b902ff319532251c17f1d6 /sync-mail
parent4aa1bbc76d00c1fd6ef624f8f745812c9fe9d9e2 (diff)
sync-mail
Diffstat (limited to 'sync-mail')
-rwxr-xr-xsync-mail30
1 files changed, 30 insertions, 0 deletions
diff --git a/sync-mail b/sync-mail
new file mode 100755
index 0000000..c5345a0
--- /dev/null
+++ b/sync-mail
@@ -0,0 +1,30 @@
+#!/bin/zsh -x
+
+$(which imapfilter) -c $HOME/.imapfilter/private.lua 2>/dev/null
+$(which imapfilter) -c $HOME/.imapfilter/work.lua 2>/dev/null
+
+case `date +"%a"` in
+ Sat|Sun)
+ $(which mbsync) -q private
+ ;;
+ *)
+ if [[ -f ~/.holiday ]]; then
+ $(which mbsync) -q private
+ else
+ $(which mbsync) -q -a
+ fi
+ ;;
+esac
+
+new="$(find $HOME/.mail/*/inbox/new/ -type f | wc -l)"
+old="$(find $HOME/.mail/*/inbox/cur/ -type f | wc -l)"
+
+if [ $new -gt 0 ]
+then
+ if [[ $(uname) == "Linux" ]]; then
+ export DISPLAY=:0
+ export XAUTHORITY=$HOME/.Xauthority;
+ /usr/bin/notify-send "You've got mail."
+ fi
+fi
+