From c5589d1625c26489b7a26f2bdab06b5a05513107 Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Sun, 2 Apr 2017 23:04:13 +0200 Subject: sync-mail --- offlineimap-notification | 11 ----------- offlineimap-switch | 17 ----------------- sync-mail | 30 ++++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 28 deletions(-) delete mode 100755 offlineimap-notification delete mode 100755 offlineimap-switch create mode 100755 sync-mail diff --git a/offlineimap-notification b/offlineimap-notification deleted file mode 100755 index eeecff0..0000000 --- a/offlineimap-notification +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/zsh - -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 - export DISPLAY=:0; export XAUTHORITY=~/.Xauthority; - notify-send "You've got mail." -fi - diff --git a/offlineimap-switch b/offlineimap-switch deleted file mode 100755 index 261518d..0000000 --- a/offlineimap-switch +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/zsh - -case `date +"%a"` in - Sat|Sun) - offlineimap -a private - ;; - *) - if [[ -f ~/.holiday ]]; then - offlineimap -a private - else - offlineimap - fi - ;; -esac - -$HOME/.local/bin/offlineimap-notification - 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 + -- cgit v1.2.3