Mutt new e-mail notifications in tmux window

emailimapmutttmux

I am on tmux, with mutt in an inactive window. If IMAP flags change on a message through external means, I see the visual bell and the status bar changes, drawing my attention to the e-mail client. That works well.

What I would like to do but still can't get to work is:

  • Get a proper notification about incoming e-mail whilst in another tmux window
  • Never get notifications later than 5 minutes from their arrival, possibly fine-tuning this interval

I use Gmail over IMAPS.

Best Answer

You could call a small script from your tmux status bar that updates with any new mail:

#!/bin/bash
# Set maildirs
maildirs="$HOME/Mail/*/INBOX/new/"

find $maildirs -type f | wc -l

And in your .tmux.conf:

set -g status-right "#[fg=yellow,bright]Mail: #(tmuxmail) ..."

This count will be updated according to the status-interval value, eg.,: set -g status-interval 1

Related Question