dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit a60bddec7bc96effc05d925b1335e5664e3ac546
parent dc57c0afba474cf55c673cb8aa01474454eeaefb
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sat, 24 Oct 2020 14:02:57 +0200

mailsync: notify with amount of unread messages per account

Former-commit-id: 2626adc35e1715121a6804bbe4c64ad340e3bb02
Diffstat:
Mscripts/mailsync | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/scripts/mailsync b/scripts/mailsync @@ -1,4 +1,17 @@ #!/bin/sh -export BW_SESSION="$(bw unlock --raw)" +BW_SESSION="$(bw unlock --raw)"; export BW_SESSION mbsync -c /Users/alex/.config/mbsync/mbsyncrc -Va notmuch new + +notification_str="" +for i in ~/.local/share/mail/*/[Ii][Nn][Bb][Oo][Xx]/new; do + mailbox_name="$(printf "%s" "$i" | sed 's:^.*mail/::; s:/[Ii][Nn][Bb][Oo][Xx]/new.*$::')" + num_new_messages="$(find "$i"/* -type f | wc -l)" + [ "$num_new_messages" -gt 0 ] \ + && notification_str="${notification_str} +$(printf "%s: %d" "$mailbox_name" "$num_new_messages")" + +done + +{ [ -n "$notification_str" ] && notify "Mail synced" "$notification_str" mail; } \ + || notify "Mail synced" "No new messages" mail