Merge branch 'dev' into logos

mail: fix new-ness check
This commit is contained in:
David JULIEN 2022-10-25 19:52:32 +02:00
commit 4676402430
Signed by: swytch
GPG Key ID: 498590A3AA82A06F
1 changed files with 4 additions and 2 deletions

View File

@ -13,6 +13,8 @@
# and the GPG home. This is done by searching common profile files for variable
# assignments.
timestamp="${XDG_STATE_HOME:-$HOME/.local/state}/mailsynclastrun"
eval "$(grep -h -- \
"^\s*\(export \)\?\(XDG_CACHE_HOME\|XDG_CONFIG_HOME\|XDG_DATA_HOME\)=" \
"$HOME/.zshenv" 2>/dev/null)"
@ -37,7 +39,7 @@ notify() {
syncandnotify() {
acc="$(echo "$account" | sed "s/.*\///")"
mbsync "$acc"
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc -path */new/* -type f | grep -iv -e "trash" -e "drafts" 2>/dev/null)"
new="$(find "${XDG_DATA_HOME:-$HOME/.local/share}"/mail/$acc -path */new/* -type f -newer "$timestamp" | grep -iv -e "trash" -e "drafts" 2>/dev/null)"
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
if [ "$newcount" -gt "0" ]; then
notify "$acc" "$newcount" &
@ -57,4 +59,4 @@ wait
notmuch new 2>/dev/null
#Create a touch file that indicates the time of the last run of mailsync
touch "${XDG_STATE_HOME:-$HOME/.local/state}/mailsynclastrun"
touch $timestamp