[mail] feat: add filters for univ
This commit is contained in:
parent
fd74b462fb
commit
438c25f4ff
3
.config/notmuch/default/hooks/post-new
Executable file
3
.config/notmuch/default/hooks/post-new
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
notmuch tag --input $XDG_CONFIG_HOME/notmuch/tags/univ
|
27
.config/notmuch/default/hooks/pre-sync
Executable file
27
.config/notmuch/default/hooks/pre-sync
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Archive files that are NOT tagged Inbox
|
||||||
|
accounts="univ"
|
||||||
|
|
||||||
|
# Update paths & tags
|
||||||
|
notmuch new --no-hooks
|
||||||
|
|
||||||
|
filter() {
|
||||||
|
notmuch search --output=files --format=text0 $parameters and tag:new| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/new/"
|
||||||
|
notmuch search --output=files --format=text0 $parameters and not tag:new| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/cur/"
|
||||||
|
}
|
||||||
|
|
||||||
|
for account in $accounts
|
||||||
|
do
|
||||||
|
tags_location="$XDG_CONFIG_HOME/notmuch/tags/$account"
|
||||||
|
tags="$(grep "+" "$tags_location" | sed -e 's/^.//' -e 's/ .*//')"
|
||||||
|
for tag in $tags
|
||||||
|
do
|
||||||
|
[ "univ" = $tag ] && continue
|
||||||
|
parameters="folder:$account/INBOX and tag:$tag"
|
||||||
|
filter
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
# Update paths
|
||||||
|
notmuch new --no-hooks
|
@ -16,9 +16,9 @@ do
|
|||||||
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc -path */new/* -type f | grep -iv -e "trash" -e "drafts" | wc -l 2>/dev/null)"
|
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc -path */new/* -type f | grep -iv -e "trash" -e "drafts" | wc -l 2>/dev/null)"
|
||||||
if [ $new -gt 0 ]; then
|
if [ $new -gt 0 ]; then
|
||||||
box=""
|
box=""
|
||||||
[ -n "$(echo "$acc" | sed -n '/@univ/p')" ] && box=""
|
[ -n "$(echo "$acc" | sed -n '/univ/p')" ] && box=""
|
||||||
[ -n "$(echo "$acc" | sed -n '/@mailo/p')" ] && box=""
|
[ -n "$(echo "$acc" | sed -n '/mailo/p')" ] && box=""
|
||||||
[ -n "$(echo "$acc" | sed -n '/@posteo/p')" ] && box=""
|
[ -n "$(echo "$acc" | sed -n '/posteo/p')" ] && box=""
|
||||||
unread="$unread/$box$new"
|
unread="$unread/$box$new"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Reference in New Issue
Block a user