diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | autoconf/domains.csv | 2 | ||||
-rw-r--r-- | etc/email.gif | bin | 0 -> 7545 bytes | |||
-rw-r--r-- | etc/mailcap | 4 | ||||
-rwxr-xr-x | etc/mailsync.sh | 37 |
5 files changed, 19 insertions, 25 deletions
@@ -5,3 +5,4 @@ accounts/ personal.muttrc thunderbird/ autoconf/log +etc/mailsynclastrun diff --git a/autoconf/domains.csv b/autoconf/domains.csv index ba33b8a..ac89878 100644 --- a/autoconf/domains.csv +++ b/autoconf/domains.csv @@ -80,7 +80,7 @@ linuxmail.org,imap.mail.com,995,smtp.mail.com,587 live.com,imap-mail.outlook.com,993,smtp-mail.outlook.com,587 loves.dicksinhisan.us,mail.cock.li,993,mail.cock.li,587 loves.dicksinmyan.us,mail.cock.li,993,mail.cock.li,587 -lukesmith.xyz,gator4171.hostgator.com,993,gator4171.hostgator.com,587 +lukesmith.xyz,mail.privateemail.com,993,mail.privateemail.com,587 mail.com,imap.mail.com,995,smtp.mail.com,587 mailbox.org,imap.mailbox.org,993,smtp.mailbox.org,465 memeware.net,mail.cock.li,993,mail.cock.li,587 diff --git a/etc/email.gif b/etc/email.gif Binary files differnew file mode 100644 index 0000000..1ed63cf --- /dev/null +++ b/etc/email.gif diff --git a/etc/mailcap b/etc/mailcap index 18dd471..1e9a613 100644 --- a/etc/mailcap +++ b/etc/mailcap @@ -1,7 +1,7 @@ #text/html; qutebrowser %s &; test=test -n "$DISPLAY"; needsterminal; -text/html; $BROWSER %s 2>/dev/null & disown; copiousoutput; -#text/html; w3m -I %{charset} -T text/html; copiousoutput; +#text/html; $BROWSER %s 2>/dev/null & disown; copiousoutput; +text/html; w3m -I %{charset} -T text/html; copiousoutput; application/pdf; mv %s %s.pdf && i3 exec mupdf %s.pdf > /dev/null; needsterminal; diff --git a/etc/mailsync.sh b/etc/mailsync.sh index 205a1c8..ca72e39 100755 --- a/etc/mailsync.sh +++ b/etc/mailsync.sh @@ -7,39 +7,32 @@ # # I have this run as a cronjob every 5 minutes. -# Check for internet connection. Exit script if none. (timeout in mac is `-t`) +export DISPLAY=:0.0 + +# Checks for internet connection and set notification script. +# Settings are different for MacOS (Darwin) systems. if [ "$(uname)" == "Darwin" ] then ping -q -t 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit + notify() { osascript -e "display notification \"$2 in $1\" with title \"Youve got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} else ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit + notify() { pgrep -x dunst && notify-send -i ~/.config/mutt/etc/email.gif "$2 new mail(s) in \`$1\` account." ;} fi -# Get current number of new mail, then begin sync. -ori=$(find ~/.mail -wholename '*/new/*' | grep -vi "spam\|trash\|junk" | wc -l) +# Run offlineimap. You can feed this script different settings. offlineimap -o "$@" -# Recount new mail. -new=$(find ~/.mail -wholename '*/new/*' | grep -vi "spam\|trash\|junk" | wc -l) - -# If new mail has grown, play a notification. -if [ "$new" -gt "$ori" ]; then - mpv --quiet ~/.config/mutt/etc/notify.opus -fi - +# Check all accounts/mailboxes for new mail. Notify if there is new content. for account in $(ls ~/.mail) do - for mailbox in $(ls ~/.mail/$account/) - do - #List unread messages newer than last mailsync and count them - newcount=$(find ~/.mail/$account/$mailbox/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l) - #Pop a Mac style notification with the count for that mailbox - if [ "$(uname)" == "Darwin" -a "$newcount" -gt "0" ] - then - osascript -e "display notification \"$newcount in $mailbox\" with title \"Youve got Mail\" subtitle \"Account: $account\"" - sleep 2 - fi - done + #List unread messages newer than last mailsync and count them + newcount=$(find ~/.mail/$account/INBOX/new/ -type f -newer ~/.config/mutt/etc/mailsynclastrun 2> /dev/null | wc -l) + if [ "$newcount" -gt "0" ] + then + notify "$account" "$newcount" & disown + mpv --quiet ~/.config/mutt/etc/notify.opus + fi done #Create a touch file that indicates the time of the last run of mailsync |