#!/bin/zsh -x if [[ $(uname) == "Darwin" ]]; then export PATH=/opt/local/bin:$PATH fi if [[ $(uname) == "Linux" ]]; then export PATH=/home/$(whoami)/.local/bin:$PATH fi case `date +"%a"` in Sat|Sun) $(which mbsync) -q primary ;; *) $(which mbsync) -q primary #$(which mbsync) -q secondary ;; esac new="$(find $HOME/.mail/primary/Inbox/new/ -type f | wc -l)" if [ $new -gt 0 ] then $(which notmuch) new if [[ $(uname) == "Linux" ]]; then export DISPLAY=:0 export XAUTHORITY=$HOME/.Xauthority; /usr/bin/notify-send "You got mail ($new)." fi if [[ $(uname) == "Darwin" ]]; then osascript -e "display notification \"$new new mails.\" with title \"You got mail.\"" $HOME/.local/bin/terminal-notifier -title "You have ✉" -message "$new new mails" -sender ID sync-mail -appIcon /System/Applications/Mail.app/Contents/Resources/ApplicationIcon.icns fi fi