diff options
Diffstat (limited to 'notmuch/default/hooks/post-new')
-rwxr-xr-x | notmuch/default/hooks/post-new | 22 |
1 files changed, 22 insertions, 0 deletions
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 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Notmuch post-new hook | ||
3 | |||
4 | # This hook is invoked by the new command after new messages have | ||
5 | # been imported into the database and initial tags have been ap‐ | ||
6 | # plied. The hook will not be run if there have been any errors | ||
7 | # during the scan or import. | ||
8 | |||
9 | # Typically this hook is used to perform additional query-based | ||
10 | # tagging on the imported messages. | ||
11 | |||
12 | # TODO: In notmuch v0.35, the location of this hook becomes configurable. | ||
13 | # When I have that installed, I want to move this to ~/.config/notmuch. | ||
14 | |||
15 | # Update tags based on folders | ||
16 | for fdir in ~/var/mail/fastmail/* ; do | ||
17 | if [[ $(basename "$fdir") != "INBOX" ]]; then | ||
18 | notmuch tag +$(basename "$fdir") -inbox -- "folder:${fdir##$HOME/var/mail/}" | ||
19 | fi | ||
20 | done | ||
21 | |||
22 | notmuch tag --batch --input="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch/post-new.tags" | ||