From a1f19f7565313027fefa9fbd2d1d804e187f266d Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 24 Oct 2023 18:15:21 +0100 Subject: [PATCH] Email updates Add afew to handle new email tagging and moving archived or deleted mail Add more notmuch emacs config - fcc dirs based on send address, saved searches default to tree view, better modeline icon --- home/accounts/afew/config | 14 ++++++++++++++ home/accounts/email.nix | 14 ++++++++++++-- home/emacs/init.el | 1 + home/emacs/modules/custom-email-config.el | 17 +++++++++++++++-- 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 home/accounts/afew/config diff --git a/home/accounts/afew/config b/home/accounts/afew/config new file mode 100644 index 00000000..808d3b30 --- /dev/null +++ b/home/accounts/afew/config @@ -0,0 +1,14 @@ +[SpamFilter] +[KillThreadsFilter] +[ListMailsFilter] +[ArchiveSentMailsFilter] +[InboxFilter] +[MailMover] +folders = Proton/Inbox iCloud/Inbox Outlook/Inbox +rename = True +max_age = 15 + +# rules +Proton/Inbox = 'tag:archive':Proton/Archive 'tag:deleted':Proton/Trash +iCloud/Inbox = 'tag:archive':iCloud/Archive 'tag:deleted':iCloud/Trash +Outlook/Inbox = 'tag:archive':Outlook/Archive 'tag:deleted':Outlook/Trash \ No newline at end of file diff --git a/home/accounts/email.nix b/home/accounts/email.nix index ff70b58f..01cdd3bb 100644 --- a/home/accounts/email.nix +++ b/home/accounts/email.nix @@ -15,9 +15,19 @@ notmuch = { enable = true; maildir.synchronizeFlags = true; - hooks.postInsert = "${pkgs.libnotify}/bin/notify-send notmuch updated"; + new.tags = [ "new" ]; + hooks.postNew = '' + if [ $(${pkgs.notmuch}/bin/notmuch count is:new) -gt 0 ]; then + ${pkgs.libnotify}/bin/notify-send "Notmuch Email" "Unread emails in inbox" + fi + ${pkgs.afew}/bin/afew --new --tag + ${pkgs.afew}/bin/afew --all --move-mail + ''; + }; + afew = { + enable = true; + extraConfig = builtins.readFile ./afew/config; }; - afew.enable = true; }; services = { mbsync = { diff --git a/home/emacs/init.el b/home/emacs/init.el index 4cc3ca9c..085fe216 100644 --- a/home/emacs/init.el +++ b/home/emacs/init.el @@ -45,6 +45,7 @@ message-sendmail-f-is-evil t message-sendmail-extra-arguments '("--read-envelope-from") message-send-mail-function #'message-send-mail-with-sendmail + message-kill-buffer-on-exit t display-line-numbers 'relative fill-column 80) diff --git a/home/emacs/modules/custom-email-config.el b/home/emacs/modules/custom-email-config.el index ebd611be..95e43b70 100644 --- a/home/emacs/modules/custom-email-config.el +++ b/home/emacs/modules/custom-email-config.el @@ -1,7 +1,20 @@ +(require 'notmuch) (notmuch-indicator-mode) -(setq notmuch-search-oldest-first nil +(setq mail-user-agent 'notmuch-user-agent + notmuch-search-oldest-first nil notmuch-show-logo nil + notmuch-hello-thousands-separator "," + notmuch-archive-tags '("-inbox" "+archive") + notmuch-fcc-dirs '((".*@proton.me" . "Proton/Sent") + (".*@icloud.com" . "iCloud/Sent") + (".*@ukaea.uk" . "Outlook/Sent")) + notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key [105] :sort-order nil :search-type tree) + (:name "unread" :query "tag:unread" :key [117] :sort-order nil :search-type tree) + (:name "flagged" :query "tag:flagged" :key [102] :sort-order nil :search-type tree) + (:name "sent" :query "tag:sent" :key [116] :sort-order nil :search-type tree) + (:name "drafts" :query "tag:draft" :key [100] :sort-order nil :search-type tree) + (:name "all mail" :query "*" :key [97] :sort-order nil :search-type tree)) notmuch-indicator-refresh-count 60 - notmuch-indicator-args '((:terms "tag:unread and tag:inbox" :label "@"))) + notmuch-indicator-args '((:terms "tag:unread and tag:inbox" :label "󰮒 "))) (provide 'custom-email-config)