feat: send one notification per account
This commit is contained in:
parent
788e1a14eb
commit
7ef29fb98f
@ -42,7 +42,7 @@ done ;}
|
|||||||
syncandnotify() {
|
syncandnotify() {
|
||||||
acc="$(echo "$account" | sed "s/.*\///")"
|
acc="$(echo "$account" | sed "s/.*\///")"
|
||||||
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
if [ -z "$opts" ]; then mbsync "$acc"; else mbsync "$opts" "$acc"; fi
|
||||||
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/*/[Ii][Nn][Bb][Oo][Xx]/new/* -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2>/dev/null)"
|
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc/[Ii][Nn][Bb][Oo][Xx]/new/* -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" 2>/dev/null)"
|
||||||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
||||||
if [ "$newcount" -gt "0" ]; then
|
if [ "$newcount" -gt "0" ]; then
|
||||||
for file in $new; do
|
for file in $new; do
|
||||||
@ -50,8 +50,8 @@ syncandnotify() {
|
|||||||
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
|
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//')
|
||||||
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
|
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n 1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n')
|
||||||
messageinfo &
|
messageinfo &
|
||||||
notify "$acc" "$newcount" &
|
|
||||||
done
|
done
|
||||||
|
notify "$acc" "$newcount" &
|
||||||
[ -n "$(pidof dwmblocks)" ] && kill -40 $(pidof dwmblocks)
|
[ -n "$(pidof dwmblocks)" ] && kill -40 $(pidof dwmblocks)
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user