Merge branch 'dev' into thesis

mail: add filters for uni
status: fix sb-mailbox
This commit is contained in:
David JULIEN 2022-11-04 16:32:02 +01:00
commit 5873736a85
2 changed files with 26 additions and 3 deletions

View File

@ -0,0 +1,23 @@
#!/usr/bin/env sh
# The accounts to be cleaned
accounts="univ"
filter() {
notmuch search --output=files --format=text0 $parameters and tag:unread| 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:unread| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/cur/"
}
for account in $accounts
do
notmuch tag --input $XDG_CONFIG_HOME/notmuch/tags/$account
tags_location="$XDG_CONFIG_HOME/notmuch/tags/$account"
tags="$(grep "+" "$tags_location" | sed -e 's/^.//' -e 's/ .*//')"
for tag in $tags
do
case $tag in
"+univ") ;;
*) parameters="folder:$account/INBOX and tag:$tag" && filter;;
esac
done
done

View File

@ -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)"
if [ $new -gt 0 ]; then
box=""
[ -n "$(echo "$acc" | sed -n '/@univ/p')" ] && box=""
[ -n "$(echo "$acc" | sed -n '/@mailo/p')" ] && box=""
[ -n "$(echo "$acc" | sed -n '/@posteo/p')" ] && box=""
[ -n "$(echo "$acc" | sed -n '/univ/p')" ] && box=""
[ -n "$(echo "$acc" | sed -n '/mailo/p')" ] && box=""
[ -n "$(echo "$acc" | sed -n '/posteo/p')" ] && box=""
unread="$unread/$box$new"
fi
done