Merge branch 'dev' into logos
mail: fix new-ness check
This commit is contained in:
commit
4676402430
@ -13,6 +13,8 @@
|
|||||||
# and the GPG home. This is done by searching common profile files for variable
|
# and the GPG home. This is done by searching common profile files for variable
|
||||||
# assignments.
|
# assignments.
|
||||||
|
|
||||||
|
timestamp="${XDG_STATE_HOME:-$HOME/.local/state}/mailsynclastrun"
|
||||||
|
|
||||||
eval "$(grep -h -- \
|
eval "$(grep -h -- \
|
||||||
"^\s*\(export \)\?\(XDG_CACHE_HOME\|XDG_CONFIG_HOME\|XDG_DATA_HOME\)=" \
|
"^\s*\(export \)\?\(XDG_CACHE_HOME\|XDG_CONFIG_HOME\|XDG_DATA_HOME\)=" \
|
||||||
"$HOME/.zshenv" 2>/dev/null)"
|
"$HOME/.zshenv" 2>/dev/null)"
|
||||||
@ -37,7 +39,7 @@ notify() {
|
|||||||
syncandnotify() {
|
syncandnotify() {
|
||||||
acc="$(echo "$account" | sed "s/.*\///")"
|
acc="$(echo "$account" | sed "s/.*\///")"
|
||||||
mbsync "$acc"
|
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)
|
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l)
|
||||||
if [ "$newcount" -gt "0" ]; then
|
if [ "$newcount" -gt "0" ]; then
|
||||||
notify "$acc" "$newcount" &
|
notify "$acc" "$newcount" &
|
||||||
@ -57,4 +59,4 @@ wait
|
|||||||
notmuch new 2>/dev/null
|
notmuch new 2>/dev/null
|
||||||
|
|
||||||
#Create a touch file that indicates the time of the last run of mailsync
|
#Create a touch file that indicates the time of the last run of mailsync
|
||||||
touch "${XDG_STATE_HOME:-$HOME/.local/state}/mailsynclastrun"
|
touch $timestamp
|
||||||
|
Reference in New Issue
Block a user