2016-03-07 17:31:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-10-29 07:08:43 +01:00
|
|
|
# Without this pinentry-gtk does not get triggered to ask for GPG password.
|
2021-02-11 09:46:19 +01:00
|
|
|
export DISPLAY=:0
|
|
|
|
|
2024-10-29 07:08:43 +01:00
|
|
|
imapfilter
|
2016-03-07 17:31:28 +01:00
|
|
|
|
2021-02-25 13:47:20 +01:00
|
|
|
# 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
|
2024-10-29 07:08:43 +01:00
|
|
|
# a result of 1 when no mails have been received. For this, we subtract 1
|
2021-02-25 13:47:20 +01:00
|
|
|
# from the result of our command.
|
|
|
|
|
2024-10-29 07:08:43 +01:00
|
|
|
if [ -d "$HOME/Mail/sanchayan-net" ]; then
|
|
|
|
mbsync sanchayan-net
|
|
|
|
inbox=$(($(find ~/Mail/sanchayan-net/Inbox/new | wc -l)-1))
|
|
|
|
if [ "$inbox" -gt 0 ]; then
|
|
|
|
notify-send "You have $inbox new mails in sanchayanmaity.net inbox"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d "$HOME/Mail/sanchayan-com" ]; then
|
|
|
|
mbsync sanchayan-com
|
|
|
|
inbox=$(($(find ~/Mail/sanchayan-com/Inbox/new | wc -l)-1))
|
|
|
|
if [ "$inbox" -gt 0 ]; then
|
|
|
|
notify-send "You have $inbox new mails in sanchayanmaity.com inbox"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-02-11 09:46:19 +01:00
|
|
|
if [ -d "$HOME/Mail/fastmail" ]; then
|
|
|
|
mbsync fastmail
|
2021-02-25 13:47:20 +01:00
|
|
|
fastmail_inbox=$(($(find ~/Mail/fastmail/Inbox/new | wc -l)-1))
|
2021-10-16 15:53:43 +02:00
|
|
|
gitlab_inbox=$(($(find ~/Mail/fastmail/FreedesktopGitlab/new | wc -l)-1))
|
2021-02-25 13:47:20 +01:00
|
|
|
if [ "$fastmail_inbox" -gt 0 ]; then
|
2021-02-11 09:46:19 +01:00
|
|
|
notify-send "You have $fastmail_inbox new mails in fastmail inbox"
|
|
|
|
fi
|
2021-10-16 15:53:43 +02:00
|
|
|
if [ "$gitlab_inbox" -gt 0 ]; then
|
|
|
|
notify-send "You have $gitlab_inbox new mails in fastmail gitlab inbox"
|
|
|
|
fi
|
2021-02-11 09:46:19 +01:00
|
|
|
fi
|
2016-03-07 17:31:28 +01:00
|
|
|
|
2021-02-11 09:46:19 +01:00
|
|
|
if [ -d "$HOME/Mail/sanchayan" ]; then
|
|
|
|
mbsync gmail
|
2021-02-25 13:47:20 +01:00
|
|
|
gmail_inbox=$(($(find ~/Mail/sanchayan/Inbox/new | wc -l)-1))
|
|
|
|
if [ "$gmail_inbox" -gt 0 ]; then
|
2021-02-11 09:46:19 +01:00
|
|
|
notify-send "You have $gmail_inbox new mails in gmail inbox"
|
|
|
|
fi
|
2016-03-07 17:31:28 +01:00
|
|
|
fi
|
2019-12-31 09:48:38 +01:00
|
|
|
|
2021-02-11 09:46:19 +01:00
|
|
|
if [ -d "$HOME/Mail/asymptotic" ]; then
|
|
|
|
mbsync asymptotic
|
2021-02-25 13:47:20 +01:00
|
|
|
asymptotic_inbox=$(($(find ~/Mail/asymptotic/Inbox/new | wc -l)-1))
|
|
|
|
if [ "$asymptotic_inbox" -gt 0 ]; then
|
2021-02-11 09:46:19 +01:00
|
|
|
notify-send "You have $asymptotic_inbox new mails in asymptotic inbox"
|
|
|
|
fi
|
2020-01-06 08:05:17 +01:00
|
|
|
fi
|