Updates to move aerc to notmuch backend instead of imap
M .config/aerc/accounts.conf +11 -5
@@ 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" <pjs@petersanchez.com>
-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 @@ pgp-opportunistic-encrypt=false
 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" <peter@netlandish.com>
 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

          
M .config/aerc/binds.conf +10 -7
@@ 54,9 54,9 @@ zR = :unfold -a<Enter>
 B = :view -b<Enter>
 #d = :prompt 'Really delete this message?' 'delete-message'<Enter>
 #D = :delete<Enter>
-d = :read<Enter>:mv Trash<Enter>
-e = :read<Enter>:mv Archive<Enter>
-S = :read<Enter>:mv Junk<Enter>
+d = :read<Enter>:mv trash<Enter>
+e = :read<Enter>:mv archive<Enter>
+S = :read<Enter>:mv junk<Enter>
 H = :read<Enter>:mv INBOX<Enter>
 u = :unread<Enter>
 a = :archive flat<Enter>

          
@@ 75,7 75,8 @@ c = :cf<space>
 ! = :term<space>
 | = :pipe<space>
 
-/ = :search<space>
+#/ = :search<space>
+/ = :query -f -n "Search Results" -a Personal<Space>
 \ = :filter<space>
 n = :next-result<Enter>
 N = :prev-result<Enter>

          
@@ 101,10 102,10 @@ ga = :flag<Enter>:pipe -mb git am -3<Ent
 gp = :term git push<Enter>
 gl = :term git log<Enter>
 
-[messages:folder=Drafts]
+[messages:folder=drafts]
 <Enter> = :recall<Enter>
 
-[messages:folder=Trash]
+[messages:folder=trash]
 d = :prompt 'Really delete this message?' 'delete-message'<Enter>
 
 [view]

          
@@ 213,8 214,10 @@ R = :header -f X-Sourcehut-Patchset-Upda
 [messages:account=Netlandish]
 A = :pipe -m khard add-email -a netlandish<Enter>
 d = :read<Enter>:mv Trash<Enter>
-e = :read<Enter>:mv "[Gmail]/All Mail"<Enter>
+#e = :read<Enter>:mv "[Gmail]/All Mail"<Enter>
+e = :read<Enter>:mv archive<Enter>
 S = :read<Enter>:mv Junk<Enter>
+/ = :query -f -n "Search Results" -a Netlandish<Space>
 
 [messages:folder="[Gmail]/Drafts"]
 <Enter> = :recall<Enter>

          
A => .config/notmuch/default/config +97 -0
@@ 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

          
A => .config/notmuch/netlandish/config +97 -0
@@ 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

          
M .localbashrc +1 -0
@@ 24,6 24,7 @@ alias fm='vifmrun'
 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 '

          
M bin/syncmail.sh +25 -28
@@ 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
+