# HG changeset patch # User Peter Sanchez # Date 1739911253 21600 # Tue Feb 18 14:40:53 2025 -0600 # Node ID dc052db00716d547751ed9216f1890d9dafabaa9 # Parent 8487d43bbf6d0527b8707d4b406693f0f33a5179 Updates to move aerc to notmuch backend instead of imap diff --git a/.config/aerc/accounts.conf b/.config/aerc/accounts.conf --- a/.config/aerc/accounts.conf +++ b/.config/aerc/accounts.conf @@ -1,9 +1,12 @@ [Personal] -source = imaps://pjs%40petersanchez.com@mail.netlandish.com -outgoing = smtp://pjs%40petersanchez.com@mail.netlandish.com +#source = maildir:///home/pjs/.mail/pjs-petersanchez.com +source = notmuch://~/.mail/pjs-petersanchez.com +maildir-store = ~/.mail/pjs-petersanchez.com +outgoing = msmtp -a pscom default = INBOX from = "Peter Sanchez" -copy-to = Sent +copy-to = sent +postpone = drafts cache-headers = true outgoing-cred-cmd = /usr/bin/secret-tool lookup email pjs@petersanchez.com source-cred-cmd = /usr/bin/secret-tool lookup email pjs@petersanchez.com @@ -13,11 +16,14 @@ signature-file=/home/pjs/.mutt/signature.pscom [Netlandish] -source = imaps://peter%40netlandish.com@imap.gmail.com -outgoing = smtps://peter%40netlandish.com@smtp.gmail.com +# source = maildir:///home/pjs/.mail/peter-netlandish.com +source = notmuch://~/.mail/peter-netlandish.com +maildir-store = ~/.mail/peter-netlandish.com +outgoing = msmtp -a netlandish default = INBOX from = "Peter Sanchez" cache-headers = true +postpone = drafts outgoing-cred-cmd = /usr/bin/secret-tool lookup email peter@netlandish.com source-cred-cmd = /usr/bin/secret-tool lookup email peter@netlandish.com signature-file=/home/pjs/.mutt/signature.netlandish diff --git a/.config/aerc/binds.conf b/.config/aerc/binds.conf --- a/.config/aerc/binds.conf +++ b/.config/aerc/binds.conf @@ -54,9 +54,9 @@ B = :view -b #d = :prompt 'Really delete this message?' 'delete-message' #D = :delete -d = :read:mv Trash -e = :read:mv Archive -S = :read:mv Junk +d = :read:mv trash +e = :read:mv archive +S = :read:mv junk H = :read:mv INBOX u = :unread a = :archive flat @@ -75,7 +75,8 @@ ! = :term | = :pipe -/ = :search +#/ = :search +/ = :query -f -n "Search Results" -a Personal \ = :filter n = :next-result N = :prev-result @@ -101,10 +102,10 @@ gp = :term git push gl = :term git log -[messages:folder=Drafts] +[messages:folder=drafts] = :recall -[messages:folder=Trash] +[messages:folder=trash] d = :prompt 'Really delete this message?' 'delete-message' [view] @@ -213,8 +214,10 @@ [messages:account=Netlandish] A = :pipe -m khard add-email -a netlandish d = :read:mv Trash -e = :read:mv "[Gmail]/All Mail" +#e = :read:mv "[Gmail]/All Mail" +e = :read:mv archive S = :read:mv Junk +/ = :query -f -n "Search Results" -a Netlandish [messages:folder="[Gmail]/Drafts"] = :recall diff --git a/.config/notmuch/default/config b/.config/notmuch/default/config new file mode 100644 --- /dev/null +++ b/.config/notmuch/default/config @@ -0,0 +1,97 @@ +# .notmuch-config - Configuration file for the notmuch mail system +# +# For more information about notmuch, see http://notmuchmail.org + +# Database configuration +# +# The only value supported here is 'path' which should be the top-level +# directory where your mail currently exists and to where mail will be +# delivered in the future. Files should be individual email messages. +# Notmuch will store its database within a sub-directory of the path +# configured here named ".notmuch". +# + +[database] +path=/home/pjs/.mail/pjs-petersanchez.com + +# User configuration +# +# Here is where you can let notmuch know how you would like to be +# addressed. Valid settings are +# +# name Your full name. +# primary_email Your primary email address. +# other_email A list (separated by ';') of other email addresses +# at which you receive email. +# +# Notmuch will use the various email addresses configured here when +# formatting replies. It will avoid including your own addresses in the +# recipient list of replies, and will set the From address based on the +# address to which the original email was addressed. +# + +[user] +name=Peter Sanchez +primary_email=pjs@petersanchez.com +#other_email=petersanchez@gmail.com;peter@netlandish.com; + +# Configuration for "notmuch new" +# +# The following options are supported here: +# +# tags A list (separated by ';') of the tags that will be +# added to all messages incorporated by "notmuch new". +# + +[new] +tags=unread;inbox; +ignore=.uidvalidity + +# Maildir compatibility configuration +# +# The following option is supported here: +# +# synchronize_flags Valid values are true and false. +# +# If true, then the following maildir flags (in message filenames) +# will be synchronized with the corresponding notmuch tags: +# +# Flag Tag +# ---- ------- +# D draft +# F flagged +# P passed +# R replied +# S unread (added when 'S' flag is not present) +# +# The "notmuch new" command will notice flag changes in filenames +# and update tags, while the "notmuch tag" and "notmuch restore" +# commands will notice tag changes and update flags in filenames +# + +[maildir] +synchronize_flags=true + +# Search configuration +# +# The following option is supported here: +# +# exclude_tags +# A ;-separated list of tags that will be excluded from +# search results by default. Using an excluded tag in a +# query will override that exclusion. +# +[search] +exclude_tags= + +# Cryptography related configuration +# +# The following *deprecated* option is currently supported: +# +# gpg_path +# binary name or full path to invoke gpg. +# NOTE: In a future build, this option will be ignored. +# Setting $PATH is a better approach. +# +[crypto] +gpg_path=gpg diff --git a/.config/notmuch/netlandish/config b/.config/notmuch/netlandish/config new file mode 100644 --- /dev/null +++ b/.config/notmuch/netlandish/config @@ -0,0 +1,97 @@ +# .notmuch-config - Configuration file for the notmuch mail system +# +# For more information about notmuch, see http://notmuchmail.org + +# Database configuration +# +# The only value supported here is 'path' which should be the top-level +# directory where your mail currently exists and to where mail will be +# delivered in the future. Files should be individual email messages. +# Notmuch will store its database within a sub-directory of the path +# configured here named ".notmuch". +# + +[database] +path=/home/pjs/.mail/peter-netlandish.com + +# User configuration +# +# Here is where you can let notmuch know how you would like to be +# addressed. Valid settings are +# +# name Your full name. +# primary_email Your primary email address. +# other_email A list (separated by ';') of other email addresses +# at which you receive email. +# +# Notmuch will use the various email addresses configured here when +# formatting replies. It will avoid including your own addresses in the +# recipient list of replies, and will set the From address based on the +# address to which the original email was addressed. +# + +[user] +name=Peter Sanchez +primary_email=peter@netlandish.com +#other_email=petersanchez@gmail.com;peter@netlandish.com; + +# Configuration for "notmuch new" +# +# The following options are supported here: +# +# tags A list (separated by ';') of the tags that will be +# added to all messages incorporated by "notmuch new". +# + +[new] +tags=unread;inbox; +ignore=.uidvalidity + +# Maildir compatibility configuration +# +# The following option is supported here: +# +# synchronize_flags Valid values are true and false. +# +# If true, then the following maildir flags (in message filenames) +# will be synchronized with the corresponding notmuch tags: +# +# Flag Tag +# ---- ------- +# D draft +# F flagged +# P passed +# R replied +# S unread (added when 'S' flag is not present) +# +# The "notmuch new" command will notice flag changes in filenames +# and update tags, while the "notmuch tag" and "notmuch restore" +# commands will notice tag changes and update flags in filenames +# + +[maildir] +synchronize_flags=true + +# Search configuration +# +# The following option is supported here: +# +# exclude_tags +# A ;-separated list of tags that will be excluded from +# search results by default. Using an excluded tag in a +# query will override that exclusion. +# +[search] +exclude_tags= + +# Cryptography related configuration +# +# The following *deprecated* option is currently supported: +# +# gpg_path +# binary name or full path to invoke gpg. +# NOTE: In a future build, this option will be ignored. +# Setting $PATH is a better approach. +# +[crypto] +gpg_path=gpg diff --git a/.localbashrc b/.localbashrc --- a/.localbashrc +++ b/.localbashrc @@ -24,6 +24,7 @@ alias shmount='mount -t ext4,tmpfs,hfsplus,fuseblk | column -t' alias cpatch='sed -e "s/^+.*$/`tput setf 6 bold`&`tput sgr0`/" \ -e "s/^-.*$/`tput setf 4 bold`&`tput sgr0`/"' +alias nlnotmuch='NOTMUCH_PROFILE=netlandish notmuch ' alias ap='/usr/bin/ag --python ' alias ag='/usr/bin/ag --go ' diff --git a/bin/syncmail.sh b/bin/syncmail.sh --- a/bin/syncmail.sh +++ b/bin/syncmail.sh @@ -1,44 +1,41 @@ -#!/bin/bash -# sync offlineimap if you have connection to the internet -# and you can ping your imap server successfully. +#!/bin/sh +# Sync email if you have an internet connection and can ping the IMAP server. runfetchflag="/home/pjs/.nofetchimap" imapserver="mail.netlandish.com" -mailsync="/usr/bin/mbsync -q PeterPS PeterIM PeterNL-inbox" +#mailsync="/usr/bin/mbsync -V -DM PeterPS PeterNL" # DEBUG +mailsync="/usr/bin/mbsync -q PeterPS PeterNL" updatesearch="/usr/bin/notmuch new" # Don't run fetch? -if [ -f $runfetchflag ]; then +if [ -f "$runfetchflag" ]; then exit 0 fi -imapactive=$(ps -ef | grep '[m]bsync' | wc -l) -netactive=$(ping -c3 $imapserver >/dev/null 2>&1 && echo up || echo down) +imapactive=$(pgrep -x mbsync >/dev/null 2>&1 && echo 1 || echo 0) +netactive=$(ping -c3 "$imapserver" >/dev/null 2>&1 && echo up || echo down) -# kill mbsync if active -case $imapactive in -'1') +# Kill mbsync if active +if [ "$imapactive" -eq 1 ]; then killall mbsync && sleep 5 -;; -esac +fi -# Check that you can access the SMTP server -case $netactive in -'up') +# Check if network is up +if [ "$netactive" = "up" ]; then echo  > ~/.config/.maildl pkill -RTMIN+12 i3blocks + # DEBUG + #$mailsync > /home/pjs/mailsynclog.txt 2>&1 $mailsync - if [ $? -eq 0 ] - then - $updatesearch - cat /dev/null > ~/.config/.maildl - pkill -RTMIN+12 i3blocks - else - echo "ERROR $?" > ~/.config/.maildl - pkill -RTMIN+12 i3blocks + if [ $? -eq 0 ]; then + for profile in "default" "netlandish"; do + NOTMUCH_PROFILE=$profile $updatesearch + done + : > ~/.config/.maildl # Clears the file + pkill -RTMIN+12 i3blocks + else + echo "ERROR $?" > ~/.config/.maildl + pkill -RTMIN+12 i3blocks fi -;; -'down') - : -;; -esac +fi +