summaryrefslogtreecommitdiff
path: root/shell-scripts/notmuch-hook
diff options
context:
space:
mode:
authorMike Vink <mike1994vink@gmail.com>2023-06-28 18:50:01 +0200
committerMike Vink <mike1994vink@gmail.com>2023-06-28 18:50:01 +0200
commit9e8d19e610bd1b0114e61451d3f21c986b5cdf4b (patch)
tree270504862cace65446cf0a58d524b25b35c11092 /shell-scripts/notmuch-hook
parentf1e83ddd51b43c8eaa3def75794e2e403c9845ec (diff)
stuff
Diffstat (limited to 'shell-scripts/notmuch-hook')
-rw-r--r--shell-scripts/notmuch-hook13
1 files changed, 10 insertions, 3 deletions
diff --git a/shell-scripts/notmuch-hook b/shell-scripts/notmuch-hook
index 268f315..12e2d05 100644
--- a/shell-scripts/notmuch-hook
+++ b/shell-scripts/notmuch-hook
@@ -1,10 +1,17 @@
. <(pass show personal/notmuch)
notmuch new --quiet
-notmuch tag -new +jobs -- from:jobs-listing* or from:jobs-noreply*
-notmuch tag -new +houses -- from:"$MAKELAAR" or thread:"{$MAKELAAR}"
-notmuch tag -new -inbox +dev -- from:/.*github.com/ or thread:"{from:/.*github.com/}"
+notmuch tag -new +unread +jobs -- 'tag:new and (from:jobs-listings* or from:jobs-noreply*)'
+notmuch tag -new +unread +houses -- 'tag:new and (from:"'$MAKELAAR'" or thread:{'$MAKELAAR'})'
+notmuch tag -new -inbox +unread +dev -- 'tag:new and (from:/.*github.com/ or thread:{from:/.*github.com/})'
notmuch tag -new +inbox +unread -- tag:new and path:gmail/Inbox/**
+
+# Gmail + mbsync = a lot of duplicates due to the archive
notmuch tag -new +archive -- 'path:gmail/Archive/** -path:gmail/Inbox/** -path:gmail/[Gmail]/** -path:gmail/FarDrafts/** -path:gmail/Important/** -path:gmail/Sent/**'
+
+# Tag messages with files that were moved to trash in neomutt
notmuch tag --remove-all +trash -- path:gmail/Trash/**
+# Same but with messages with files that were moved to spam
notmuch tag --remove-all +spam -- folder:/Spam/
+# Remove files of messages that were tagged but still have files left behind in the mailbox, should be fine since gmail already keeps a duplicate in the Archive so the message will not be deleted only one file of the message
+notmuch search --output=files -- 'path:gmail/Inbox/** -tag:inbox' | grep Inbox | xargs >/dev/null 2>&1 rm