mutt: mailnotify: Fix the mail count logic
This commit is contained in:
parent
3707429737
commit
97595d9e6e
1 changed files with 11 additions and 6 deletions
|
@ -4,26 +4,31 @@ export DISPLAY=:0
|
||||||
|
|
||||||
imapfilter -c ~/.imapfilter/config.lua
|
imapfilter -c ~/.imapfilter/config.lua
|
||||||
|
|
||||||
|
# find also outputs the directory itself it is given as input and since we
|
||||||
|
# count the lines in output for checking the number of mails, this gives
|
||||||
|
# a result of 1 when no mails have been received. For this, we substract 1
|
||||||
|
# from the result of our command.
|
||||||
|
|
||||||
if [ -d "$HOME/Mail/fastmail" ]; then
|
if [ -d "$HOME/Mail/fastmail" ]; then
|
||||||
mbsync fastmail
|
mbsync fastmail
|
||||||
fastmail_inbox=$(find ~/Mail/fastmail/Inbox/new | wc -l)
|
fastmail_inbox=$(($(find ~/Mail/fastmail/Inbox/new | wc -l)-1))
|
||||||
if [ "$fastmail_inbox" -gt 1 ]; then
|
if [ "$fastmail_inbox" -gt 0 ]; then
|
||||||
notify-send "You have $fastmail_inbox new mails in fastmail inbox"
|
notify-send "You have $fastmail_inbox new mails in fastmail inbox"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$HOME/Mail/sanchayan" ]; then
|
if [ -d "$HOME/Mail/sanchayan" ]; then
|
||||||
mbsync gmail
|
mbsync gmail
|
||||||
gmail_inbox=$(find ~/Mail/sanchayan/Inbox/new | wc -l)
|
gmail_inbox=$(($(find ~/Mail/sanchayan/Inbox/new | wc -l)-1))
|
||||||
if [ "$gmail_inbox" -gt 1 ]; then
|
if [ "$gmail_inbox" -gt 0 ]; then
|
||||||
notify-send "You have $gmail_inbox new mails in gmail inbox"
|
notify-send "You have $gmail_inbox new mails in gmail inbox"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$HOME/Mail/asymptotic" ]; then
|
if [ -d "$HOME/Mail/asymptotic" ]; then
|
||||||
mbsync asymptotic
|
mbsync asymptotic
|
||||||
asymptotic_inbox=$(find ~/Mail/asymptotic/Inbox/new | wc -l)
|
asymptotic_inbox=$(($(find ~/Mail/asymptotic/Inbox/new | wc -l)-1))
|
||||||
if [ "$asymptotic_inbox" -gt 1 ]; then
|
if [ "$asymptotic_inbox" -gt 0 ]; then
|
||||||
notify-send "You have $asymptotic_inbox new mails in asymptotic inbox"
|
notify-send "You have $asymptotic_inbox new mails in asymptotic inbox"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue