[mail] fix: globbing for subdirectories

This commit is contained in:
David JULIEN 2022-10-19 23:27:18 +02:00
parent d5714c0ca2
commit 5cce96f8ad
2 changed files with 4 additions and 4 deletions

View File

@ -40,7 +40,7 @@ messageinfo() {
syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")"
mbsync "$acc"
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc/*/new/ -type f -newer "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun" | grep -iv "trash" 2>/dev/null)"
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc -path */new/* -type f -newer "${XDG_STATE_HOME:-$HOME/.local/state}/mailsynclastrun" | grep -iv "trash" 2>/dev/null)"
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
if [ "$newcount" -gt "0" ]; then
for file in $new; do
@ -66,4 +66,4 @@ wait
notmuch new 2>/dev/null
#Create a touch file that indicates the time of the last run of mailsync
touch "${XDG_CONFIG_HOME:-$HOME/.config}/mutt/.mailsynclastrun"
touch "${XDG_STATE_HOME:-$HOME/.local/state}/mailsynclastrun"

View File

@ -13,7 +13,7 @@
unread=""
for acc in $(ls "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/)
do
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc/*/new/ -type f | grep -iv "trash" | wc -l 2>/dev/null)"
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc -path */new/* -type f | grep -iv "trash" | wc -l 2>/dev/null)"
if [ $new -gt 0 ]; then
box=""
[ -n "$(echo "$acc" | sed -n '/@centrale/p')" ] && box=""
@ -23,6 +23,6 @@ do
unread="$unread/$box$new"
fi
done
[ -n "$unread" ] && unread="($(echo "$unread" | cut -c 2-))" || exit
[ -n "$unread" ] && unread="$(echo "$unread" | cut -c 2-)" || exit
printf "  %s%s " "$unread" "$icon"