From 0d00953f3008cea1b0a40f7abf95b1bea388bf4a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 18 Sep 2020 12:25:49 +0200 Subject: [PATCH] mail: Add afew automatic tagging Added hook for afew tagging for local mail. Mail will now arrive tagged only as 'new' by notmuch. afew will then tag the mail accordingly as inbox unread when it is personal mail. It will additionally filter out anything marked as spam, or e-mail containing a List-Id header, which will be tagged as 'list' and not arrive in the inbox. This filters out anything arriving from a mailing list from the inbox. Removed the archive tag -- anything not in the inbox, and not marked as list is instead used as an automatic archive. Mail sent by myself will be automatically tagged as 'sent' and also not show up in the mailbox. --- bootstrap/packages.txt | 3 +- mail/.config/aerc/binds.conf | 28 +++++++++---------- mail/.config/aerc/notmuch-querymap | 6 ++-- mail/.config/afew/config | 6 ++++ .../imapfilter/filters/rollup-dump.lua | 20 ++++++------- mail/.config/notmuch/config | 2 +- 6 files changed, 32 insertions(+), 33 deletions(-) create mode 100644 mail/.config/afew/config diff --git a/bootstrap/packages.txt b/bootstrap/packages.txt index 11f8a11..7b1335b 100644 --- a/bootstrap/packages.txt +++ b/bootstrap/packages.txt @@ -1,4 +1,5 @@ aerc +afew alacritty an2linuxserver-git anki @@ -33,7 +34,6 @@ glances glow gnome-keyring go -gopass grub hugo i3-gaps @@ -78,6 +78,7 @@ ntp os-prober pacman-contrib pandoc-citeproc +pass pavolume pdfjs pia-tools diff --git a/mail/.config/aerc/binds.conf b/mail/.config/aerc/binds.conf index e39cf31..5e5609e 100644 --- a/mail/.config/aerc/binds.conf +++ b/mail/.config/aerc/binds.conf @@ -23,17 +23,15 @@ k = :prev gg = :select 0 G = :select -1 -J = :next-folder +c = :cf = :next-folder -K = :prev-folder = :prev-folder -gi = :cf Inbox -g' = :cf Important -' = :cf Important -ga = :cf Archive -gA = :cf All -gs = :cf Sent -gt = :cf Trash +'' = :cf Inbox +'i = :cf Important +'a = :cf Archive +'A = :cf All +'s = :cf Sent +'t = :cf Trash v = :mark -t V = :mark -v @@ -41,11 +39,12 @@ V = :mark -v = :view l = :view D = :prompt 'Really delete this message?' 'delete-message' -i = :modify-labels +inbox -archived -deleted -m = :modify-labels +flagged -d = :modify-labels +deleted -inbox -archived -a = :modify-labels +archived -deleted -inbox -A = :modify-labels +archived -deleted -inbox +mi = :modify-labels +inbox -archived -deleted +mm = :modify-labels +flagged +mI = :modify-labels +flagged +md = :modify-labels +deleted -inbox +mD = :modify-labels -deleted +ma = :modify-labels -deleted -inbox C = :compose @@ -54,7 +53,6 @@ rq = :reply -aq Rr = :reply Rq = :reply -q -c = :cf $ = :term ! = :term | = :pipe diff --git a/mail/.config/aerc/notmuch-querymap b/mail/.config/aerc/notmuch-querymap index 08f54e9..924c80e 100644 --- a/mail/.config/aerc/notmuch-querymap +++ b/mail/.config/aerc/notmuch-querymap @@ -1,9 +1,7 @@ All=* -Inbox=tag:inbox and not tag:archived and not tag:dump -Archive=tag:archived and not tag:inbox and not tag:dump +Inbox=tag:inbox and not tag:lists +Archive=not tag:inbox and not tag:deleted and not tag:dump Dump=tag:dump and not tag:inbox Trash=tag:deleted Important=tag:flagged Sent=from:marty.oehme@gmail.com or from:marty.oehme@googlemail.com or from:moehme@ruc.dk or from:mo82rimu@studserv.uni-leipzig.de -Replied=tag:replied -Patches=subject:/^\[PATCH/ diff --git a/mail/.config/afew/config b/mail/.config/afew/config new file mode 100644 index 0000000..3aabf78 --- /dev/null +++ b/mail/.config/afew/config @@ -0,0 +1,6 @@ +[SpamFilter] +[KillThreadsFilter] +[ListMailsFilter] +[ArchiveSentMailsFilter] +sent_tag=sent +[InboxFilter] diff --git a/mail/.config/imapfilter/filters/rollup-dump.lua b/mail/.config/imapfilter/filters/rollup-dump.lua index 2fd8290..3004578 100644 --- a/mail/.config/imapfilter/filters/rollup-dump.lua +++ b/mail/.config/imapfilter/filters/rollup-dump.lua @@ -1,22 +1,16 @@ -function sendtoRollup(acc, senders) +function sendToFolder(folderFrom, folderTo, senders) for _, sender in pairs(senders) do - messages = acc["Inbox"]:contain_from(sender) + messages = folderFrom:contain_from(sender) messages:mark_seen() - messages:move_messages(acc["Dump"]) - - -- for _, msg in ipairs(messages) do - -- mailbox, uid = table.unpack(msg) - -- local from = mailbox[uid]:fetch_field("From") - -- local subject = mailbox[uid]:fetch_field("Subject") - -- print(from .. "; " .. subject) - -- end + messages:move_messages(folderTo) end end for _, acc in pairs(accounts) do - sendtoRollup ( acc, { + sendToFolder ( acc["Inbox"], acc["Dump"], + { "news@todoist.com", "server@email.woommart.com", "noreply@medium.com", @@ -34,6 +28,8 @@ for _, acc in pairs(accounts) do "waitlist@isthereanydeal.com", "info@mynameisgriz.com", "news@postman.com", - + "no-reply@tumblr.com", + "contact@mailer.humblebundle.com", + "info@audible.de" }) end diff --git a/mail/.config/notmuch/config b/mail/.config/notmuch/config index f898572..5ef4671 100644 --- a/mail/.config/notmuch/config +++ b/mail/.config/notmuch/config @@ -48,7 +48,7 @@ other_email=mo82rimu@studserv.uni-leipzig.de;moehme@ruc.dk; # in the mail store. # [new] -tags=unread;inbox; +tags=new ignore= # Search configuration