From 1f79d43d4100bede184fcf4f91842f30cd6f66b3 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 22 Dec 2014 13:20:38 -0500 Subject: [PATCH] Move mu4e and add a timeout to its invocation. --- dotfiles/lib/{shellrc => shellenv}/mu4e.sh | 5 +++++ 1 file changed, 5 insertions(+) rename dotfiles/lib/{shellrc => shellenv}/mu4e.sh (95%) diff --git a/dotfiles/lib/shellrc/mu4e.sh b/dotfiles/lib/shellenv/mu4e.sh similarity index 95% rename from dotfiles/lib/shellrc/mu4e.sh rename to dotfiles/lib/shellenv/mu4e.sh index 7555a603..ab06eb7a 100644 --- a/dotfiles/lib/shellrc/mu4e.sh +++ b/dotfiles/lib/shellenv/mu4e.sh @@ -2,6 +2,7 @@ MAILDIR="$HOME/Mail/INBOX/" SYNC_STAMP="$HOME/.mail-sync" APP_ICON="$(dotfiles_directory)/resources/gmail_logo.png" SYNC_COMMAND="offlineimap -f INBOX" +TIMEOUT="60" function mu4e_alert_for_filename { local message="$(mu view $1 | grep -B 10 Date)" @@ -20,6 +21,10 @@ function mu4e_alert_for_filename { } function mu4e_update_mail { + timeout $TIMEOUT zsh -c "_mu4e_update_mail" +} + +function _mu4e_update_mail { eval $SYNC_COMMAND if test -z "$(find "$MAILDIR" -cnewer "$SYNC_STAMP" -a -type f)"; then echo "$(date) - No new messages, skipping alerting and indexing."