Fix notmuch inbox tag to match IMAP INBOX folder
Previously, the notmuch config applied the "inbox" tag to all new messages regardless of which IMAP folder they were in. This caused tag:inbox to return all 22k+ messages instead of just those in INBOX. Changes: - Use temporary "new" tag instead of "inbox" for newly indexed messages - Add post-new hook that applies tags based on maildir folder location - inbox tag now only applies to messages in INBOX folder - Also adds sent, draft, spam, deleted, and archive tags based on folder
This commit is contained in:
@@ -62,7 +62,7 @@ in
|
|||||||
primary_email=john@ogle.fyi
|
primary_email=john@ogle.fyi
|
||||||
|
|
||||||
[new]
|
[new]
|
||||||
tags=unread;inbox;
|
tags=unread;new;
|
||||||
ignore=
|
ignore=
|
||||||
|
|
||||||
[search]
|
[search]
|
||||||
@@ -72,6 +72,38 @@ in
|
|||||||
synchronize_flags=true
|
synchronize_flags=true
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Notmuch post-new hook for folder-based tagging
|
||||||
|
home.file."Mail/.notmuch/hooks/post-new" = {
|
||||||
|
executable = true;
|
||||||
|
text = ''
|
||||||
|
#!${pkgs.bash}/bin/bash
|
||||||
|
# Tag messages based on their maildir folder location
|
||||||
|
# This runs after 'notmuch new' indexes new messages
|
||||||
|
|
||||||
|
# Process only messages with the 'new' tag (just indexed)
|
||||||
|
# Add inbox tag only for messages in INBOX folder
|
||||||
|
${pkgs.notmuch}/bin/notmuch tag +inbox -- tag:new AND folder:INBOX
|
||||||
|
|
||||||
|
# Add sent tag for messages in Sent folder
|
||||||
|
${pkgs.notmuch}/bin/notmuch tag +sent -inbox -- tag:new AND folder:Sent
|
||||||
|
|
||||||
|
# Add draft tag for messages in Drafts folder
|
||||||
|
${pkgs.notmuch}/bin/notmuch tag +draft -inbox -- tag:new AND folder:Drafts
|
||||||
|
|
||||||
|
# Add spam tag for messages in Spam folder
|
||||||
|
${pkgs.notmuch}/bin/notmuch tag +spam -inbox -unread -- tag:new AND folder:Spam
|
||||||
|
|
||||||
|
# Add deleted tag for messages in Trash folder
|
||||||
|
${pkgs.notmuch}/bin/notmuch tag +deleted -inbox -unread -- tag:new AND folder:Trash
|
||||||
|
|
||||||
|
# Add archive tag for messages in Archive folder
|
||||||
|
${pkgs.notmuch}/bin/notmuch tag +archive -inbox -- tag:new AND folder:Archive
|
||||||
|
|
||||||
|
# Remove the temporary 'new' tag from all messages
|
||||||
|
${pkgs.notmuch}/bin/notmuch tag -new -- tag:new
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
# msmtp configuration
|
# msmtp configuration
|
||||||
home.file.".msmtprc".text = ''
|
home.file.".msmtprc".text = ''
|
||||||
# Default settings
|
# Default settings
|
||||||
|
|||||||
Reference in New Issue
Block a user