diff --git a/bin/.bin/emails/check-emails b/bin/.bin/emails/check-emails index 99d52a8f..bd35980f 100755 --- a/bin/.bin/emails/check-emails +++ b/bin/.bin/emails/check-emails @@ -10,6 +10,11 @@ die(){ exit 1 } +export NOTMUCH_CONFIG="$HOME/.config/notmuch/config" + +folder="${1:-all}" + + # Ping 1.1.1.1 to confirm that we are on the internet ping -c 1 "1.1.1.1" > /dev/null 2> /dev/null || die "Need to be connected to the internet" @@ -17,7 +22,12 @@ ping -c 1 "1.1.1.1" > /dev/null 2> /dev/null || die "Need to be connected to the ps -aux | grep -v grep | grep -q davmail || die "Need to start davmail" # Sync maildir with exchange -mbsync -c "$HOME/.config/isync/mbsyncrc.secret" work +mbsync -c "$HOME/.config/isync/mbsyncrc.secret" "work-$folder" # Update notmuch database notmuch new + +new="$(notmuch count "tag:unread")" + + +[ "$new" -gt "0" ] && notify-send "$new new messages" diff --git a/isync/.config/isync/mbsyncrc b/isync/.config/isync/mbsyncrc index 0a4b6846..0d56fdf5 100644 --- a/isync/.config/isync/mbsyncrc +++ b/isync/.config/isync/mbsyncrc @@ -20,7 +20,7 @@ Subfolders Verbatim Path ~/.mail/work/ Inbox ~/.mail/work/Inbox -Channel work +Channel work-all Master :work-remote: Slave :work-local: # Include everything, except Sync Issues @@ -29,3 +29,13 @@ Patterns * !'Sync Issues' !'Sync Issues/*' Create Both # Save the synchronization state files in the relevant directory SyncState * + +Channel work-inbox +Master :work-remote: +Slave :work-local: +# Only sync Inbox +Patterns Inbox Sent +# Automatically create missing mailboxes, both locally and on the server +Create Both +# Save the synchronization state files in the relevant directory +SyncState * diff --git a/isync/.config/isync/mbsyncrc.secret b/isync/.config/isync/mbsyncrc.secret index 9007bb8f..7d3d7553 100644 Binary files a/isync/.config/isync/mbsyncrc.secret and b/isync/.config/isync/mbsyncrc.secret differ diff --git a/mutt/.config/mutt/muttrc b/mutt/.config/mutt/muttrc index c20db0e0..049b3cb5 100644 --- a/mutt/.config/mutt/muttrc +++ b/mutt/.config/mutt/muttrc @@ -82,7 +82,8 @@ bind index N search-opposite macro index C "?" "copy a message to a mailbox" macro index M "?" "move a message to a mailbox" -macro index o "check-emails" "Check Emails" +macro index o "check-emails inbox" "Check Emails" +macro index O "check-emails" "Check Emails" ###################### # Sidebar Settings # ###################### @@ -170,7 +171,7 @@ macro index,pager a "abook --add-email-quiet" "Add this s # Don't ask to push enter after external command is run set wait_key = no # https://neomutt.org/guide/reference#wait_key # Send a notification when a new email arrives -set new_mail_command = "notify-send 'New Email'" # https://neomutt.org/guide/reference#new_mail_command +# set new_mail_command = "notify-send 'New Email'" # https://neomutt.org/guide/reference#new_mail_command # Makes escape key cancel inputs. Normally it's ctrl+G (weird) set abort_key = "" # https://neomutt.org/guide/reference#abort_key # My Name