diff options
author | Joe <bousset.rudy@gmail.com> | 2022-08-17 21:00:22 +0200 |
---|---|---|
committer | Joe <bousset.rudy@gmail.com> | 2022-08-17 21:00:22 +0200 |
commit | e1d29a0aa87d18125b784053582908348618afb4 (patch) | |
tree | 78c94286ef5c0ea5c3718030e5c2810aae2ed010 | |
parent | update (diff) | |
download | dotfiles-bsd-e1d29a0aa87d18125b784053582908348618afb4.tar.gz dotfiles-bsd-e1d29a0aa87d18125b784053582908348618afb4.tar.bz2 dotfiles-bsd-e1d29a0aa87d18125b784053582908348618afb4.tar.xz dotfiles-bsd-e1d29a0aa87d18125b784053582908348618afb4.tar.zst dotfiles-bsd-e1d29a0aa87d18125b784053582908348618afb4.zip |
perfect
-rw-r--r-- | .config/mutt/defaults.muttrc | 1 | ||||
-rwxr-xr-x | .local/bin/fetch_mail.sh | 20 |
2 files changed, 18 insertions, 3 deletions
diff --git a/.config/mutt/defaults.muttrc b/.config/mutt/defaults.muttrc index 175c686..48d8afa 100644 --- a/.config/mutt/defaults.muttrc +++ b/.config/mutt/defaults.muttrc @@ -7,7 +7,6 @@ set editor = "emacsclient -nw -a nvim" set mailcap_path = $XDG_CONFIG_HOME/mutt/mailcap set date_format="%d/%m/%y %H:%M" set index_format="%S %?X?A& ? %D %-24.24F %s (%c)" -set new_mail_command = "notify-send -u normal 'NeoMutt' ' %n new mail(s)'" set sort = reverse-threads set sort_aux = last-date-received set smtp_authenticators = 'gssapi:login' diff --git a/.local/bin/fetch_mail.sh b/.local/bin/fetch_mail.sh index a3c6d75..2c96082 100755 --- a/.local/bin/fetch_mail.sh +++ b/.local/bin/fetch_mail.sh @@ -5,13 +5,29 @@ set -m export GNUPGHOME=/home/jozan/.local/share/gnupg export PASSWORD_STORE_DIR=/home/jozan/.local/share/pass +mc_file="/tmp/newmailcount" +if [ -f $mc_file ]; then + pre_count=$(cat $mc_file) +else + pre_count="$(ls "${MAIL:-/var/mail/jozan}"/bousset.rudy@gmail.com/INBOX/new | wc -l 2>/dev/null)" + tmp="$(ls "${MAIL:-/var/mail/jozan}"/olsen.oyvind.nor@gmail.com/INBOX/new | wc -l 2>/dev/null)" + pre_count="$((pre_count + tmp))" +fi killall mbsync >/dev/null 2>&1 notify-send -u low -t 3000 'mbsync' ' fetching mail...' >/dev/null 2>&1 { mbsync -a -c /usr/home/jozan/.config/mbsync/mbsyncrc || - notify-send -u low -t 6000 'mbsync' ' failed to fetch mail' >/dev/null 2>&1 && - (sleep 1; kill -74 $(pidof dwmblocks) >/dev/null 2>&1) + notify-send -u low -t 6000 'mbsync' ' failed to fetch mail' >/dev/null 2>&1 }& gsleep 0.2 kill -74 $(pidof dwmblocks) >/dev/null 2>&1 fg +post_count="$(ls "${MAIL:-/var/mail/jozan}"/bousset.rudy@gmail.com/INBOX/new | wc -l 2>/dev/null)" +tmp="$(ls "${MAIL:-/var/mail/jozan}"/olsen.oyvind.nor@gmail.com/INBOX/new | wc -l 2>/dev/null)" +post_count="$((post_count + tmp))" +if [ $post_count -gt $pre_count ]; then + notify-send -u normal 'NeoMutt' ' '$post_count' new mail(s)' +fi +echo $post_count >$mc_file +sleep 1 +kill -74 $(pidof dwmblocks) >/dev/null 2>&1 |