From acba5f4559dcafd3ad2d51992d91b5deb5e6d8c0 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 19 Sep 2020 11:09:20 +0100 Subject: [PATCH] Allow syncing of just inbox rather than all mailboxes --- bin/.bin/emails/check-emails | 12 +++++++++++- isync/.config/isync/mbsyncrc | 12 +++++++++++- isync/.config/isync/mbsyncrc.secret | Bin 803 -> 1068 bytes mutt/.config/mutt/muttrc | 5 +++-- 4 files changed, 25 insertions(+), 4 deletions(-) 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 9007bb8fa5c8095fc519a7da63383faadaaa552d..7d3d7553aab07bfe6f0394fe796784104ef85de6 100644 GIT binary patch literal 1068 zcmV+{1k?KfM@dveQdv+`05@fems%fddwK45VyUM$M#!3p5&9Ywva>90)%{BhGGwz? zZ`;k!t=$zx1qm>o1MML?$Aul{**UYbiog2q%UGVbL@D63RBmEUc9yl7@q|!le(FkwjyU2a|G+iBVMB z+A{(V0Dl*o`wvK{fh?35Gv)98ms!iOfQfA$mDef`tIW%~Q9!gcVs&Fsn2X4?L(*?o zQC(r5EYx2>4n0Y;%0+yEu_nbGgoC+JWt?%@nQk!`qN&hsUn#KrrZZ_VwtOVT1+4GJNbTj-oO+Ni zI8a_9-vCWUP3|}p(@#dj2MJO2eem|ShV-SBD(>)j`BP3jh-OkM$%K~8qiDH&+nAU| zRKxmo$!F$}8-3Mh%Yd*$c$oB?AF#)`d$o^d59#%2;I)d}?g>I+P z_|y}es9Wh4@9?;HggQ9pW0rmOMM;;O z(ehU!!Mz4%_D!DN09d_Mtw{VYq_-S^9A@bQc=}?m51;uYRc5K|@eFg!n)BlqjsYXK z-uO$TmOeal{BQW5SX?|M(v9E^Sx!m#UFg})_UF~hI1o!Hx$$a(H^$Ejb0S!S#WwXN zg!=G702=b{*Kf~8S>y>CcnvtNubpuR9tt5!j6zRUKo0_5m%#i05z>G@O}ASW8(+3Q z3yi>2N&N$_IQxe?)j`|t-&(tu7dUT($#`oY}TFWxE=nI>K~}I62>)ese}!P z!MF_2p_E8xoR{VTOqfv=Dsiey3?cXN=bx41z}lQ_)jbk--bWY?`~7VIi18mL_47Cp`mOVOT49_Th2DA|5Hr{U^D m4rk2E=S^MnsukbGd*z%Qdk zucWYUu1f2Kf7t+<25iv2^NPbTF0eB33h6sX*`*Vx6bP*oK!gD>w?Mw zm~EyN4kAF+3$}OJC7;Xp0vSb|Ok94dMfOWIR29SaRlxFXXPwz&m`e%;kG4gnX}8Rv zJ)(TL27hM?q^@JI|Dw7PGWK|B+|ABd6#Os&d)YQ6*wep!+%~FXFWU&}lXQ6)*$3*w zlW9Z+Kz2|KyD@@qM{88;k?#NCYq(Z!ss~+g&`Cl zd6h&l?HW;BWF9$gsiEX5T9jO(OJ4if}f2t?6e`#GpQO6PSD7P6z&#O#!DVF@zw zbB$ZM=)QKtKeo%!cpQ_)E^ct}gRf&k$b0VwqPIQ3A@H1DN0kLel%NTn)~hA;wa%zSLPzqSOt55bwEE1=a;xeaH$Q0`Ja<9d!9J|wT- zdL|*q8$#)pq?8r)o+(BWTj7I%NSv*^c!D3P?ey1Qp9oroD^ehJ=VL^Cb-bat1gx`P z+d`}j$tsc{kNnKm_1DENwSw+^X(G1| hX56b4U|@xP7i0tJ{N6ymQCaxfoErFahq6m@(WJ}Gkr)5~ 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