aerc-wizard

aerc and isync auto-configuration
git clone https://git.awy.one/aerc-wizard
Log | Files | Refs | README | LICENSE

commit a0d11c2c1ff46ae7ef792a184835227e20d45802
parent 8d6ccf6dda83933e1a0402228442cd46031ce184
Author: awy <awy@awy.one>
Date:   Tue, 23 Dec 2025 01:25:29 +0300

gmail fixes

Diffstat:
Mbin/mailsync | 4+++-
Mbin/mw | 20++++++++++++++++++--
Ashare/mbsync-gmail-temp | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 88 insertions(+), 3 deletions(-)

diff --git a/bin/mailsync b/bin/mailsync @@ -83,7 +83,8 @@ syncandnotify() { esac } -allaccounts="$(grep -hs "^\(Channel\|account\)" "$MBSYNCRC" "$MPOPRC")" +allaccounts="$(grep -hs "^\(Channel\|Group\|account\)" "$MBSYNCRC" "$MPOPRC")" +allaccounts=$(echo "$allaccounts" | grep -v 'gmail\.com-[^ ]*') # Get accounts to sync. All if no argument. Prefix with `error` if non-existent. IFS=' @@ -99,6 +100,7 @@ fi for account in $tosync; do case $account in Channel*) syncandnotify imap "${account##* }" & ;; + Group*) syncandnotify imap "${account##* }" & ;; account*) syncandnotify pop "${account##* }" & ;; error*) echo "ERROR: Account ${account##* } not found." ;; esac diff --git a/bin/mw b/bin/mw @@ -15,6 +15,7 @@ mpoprc="${XDG_CONFIG_HOME:-$HOME/.config}/mpop/config" imapnotify="${XDG_CONFIG_HOME:-$HOME/.config}/imapnotify" mpoptemp="$muttshare/mpop-temp" mbsynctemp="$muttshare/mbsync-temp" +mbsyncgmailtemp="$muttshare/mbsync-gmail-temp" mutttemp="$muttshare/mutt-temp" msmtptemp="$muttshare/msmtp-temp" onlinetemp="$muttshare/online-temp" @@ -77,7 +78,14 @@ prepmsmtp() { prepmbsync() { mkdir -p "${mbsyncrc%/*}" [ -f "$mbsyncrc" ] && echo >>"$mbsyncrc" - envsubst <"$mbsynctemp" >>"$mbsyncrc" + case "$fulladdr" in + *@gmail.com) + envsubst <"$mbsyncgmailtemp" >>"$mbsyncrc" + ;; + *) + envsubst <"$mbsynctemp" >>"$mbsyncrc" + ;; + esac } prepmpop() { @@ -233,7 +241,15 @@ getboxes() { idnum=$((idnum + 1)) [ "$idnum" -eq "$x" ] || break done - toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' -)" + case "$fulladdr" in + *@gmail.com) + mailboxes=$(echo "$mailboxes" | sed -e 's#^\[Gmail\]/##' -e 's/^Sent Mail$/Sent/' -e 's/^Spam$/Junk/') + toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' -)" + ;; + *) + toappend="mailboxes $(echo "$mailboxes" | sed "s/^/\"=/;s/$/\"/;s/'/\\\'/g" | paste -sd ' ' -)" + ;; + esac } finalize() { diff --git a/share/mbsync-gmail-temp b/share/mbsync-gmail-temp @@ -0,0 +1,67 @@ +IMAPStore $fulladdr-remote +Host $imap +Port $iport +User $login +PassCmd "gopass $passprefix$fulladdr" +AuthMechs LOGIN +TLSType $imapssl +CertificateFile $sslcert + +MaildirStore $fulladdr-local +Subfolders Verbatim +Path $maildir/$fulladdr/ +Inbox $maildir/$fulladdr/INBOX + +Channel sync-$fulladdr-default +Expunge Both +$master :$fulladdr-remote: +$slave :$fulladdr-local: +Patterns * !"[Gmail]/*" !"*fts-flatcurve*" !"*virtual*" !Sent !Trash !Drafts !Spam !Junk +Create Both +SyncState * +MaxMessages $maxmes +ExpireUnread no + +Channel sync-$fulladdr-sent +Expunge Both +$master :$fulladdr-remote:"[Gmail]/Sent Mail" +$slave :$fulladdr-local:"Sent" +Create Near +SyncState * +MaxMessages $maxmes +ExpireUnread no + +Channel sync-$fulladdr-trash +Expunge Both +$master :$fulladdr-remote:"[Gmail]/Trash" +$slave :$fulladdr-local:"Trash" +Create Near +SyncState * +MaxMessages $maxmes +ExpireUnread no + +Channel sync-$fulladdr-drafts +Expunge Both +$master :$fulladdr-remote:"[Gmail]/Drafts" +$slave :$fulladdr-local:"Drafts" +Create Near +SyncState * +MaxMessages $maxmes +ExpireUnread no + +Channel sync-$fulladdr-spam +Expunge Both +$master :$fulladdr-remote:"[Gmail]/Spam" +$slave :$fulladdr-local:"Junk" +Create Near +SyncState * +MaxMessages $maxmes +ExpireUnread no + +Group $fulladdr +Channel sync-$fulladdr-default +Channel sync-$fulladdr-sent +Channel sync-$fulladdr-trash +Channel sync-$fulladdr-spam +Channel sync-$fulladdr-drafts +# End profile