From 1d562af8927d932bc3329de3b06c94a966047238 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 30 Jan 2023 17:33:06 -0600 Subject: Add a bunch of stuff Forgot I had to `git add -f' these! --- notmuch/default/hooks/post-new | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 notmuch/default/hooks/post-new (limited to 'notmuch/default/hooks/post-new') diff --git a/notmuch/default/hooks/post-new b/notmuch/default/hooks/post-new new file mode 100755 index 0000000..744c334 --- /dev/null +++ b/notmuch/default/hooks/post-new @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Notmuch post-new hook + +# This hook is invoked by the new command after new messages have +# been imported into the database and initial tags have been ap‐ +# plied. The hook will not be run if there have been any errors +# during the scan or import. + +# Typically this hook is used to perform additional query-based +# tagging on the imported messages. + +# TODO: In notmuch v0.35, the location of this hook becomes configurable. +# When I have that installed, I want to move this to ~/.config/notmuch. + +# Update tags based on folders +for fdir in ~/var/mail/fastmail/* ; do + if [[ $(basename "$fdir") != "INBOX" ]]; then + notmuch tag +$(basename "$fdir") -inbox -- "folder:${fdir##$HOME/var/mail/}" + fi +done + +notmuch tag --batch --input="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch/post-new.tags" -- cgit 1.4.1-21-gabe81