diff options
author | Thomas Voss <mail@thomasvoss.com> | 2023-09-15 00:19:02 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2023-09-15 00:19:02 +0200 |
commit | 28b6bc4d05bdaeae723e0b923e3630adf1ebc083 (patch) | |
tree | bba36330fbfe72a68e375b938004edce00c442d9 | |
parent | 45d1380289c577f1a04c8117ff36ff374d82023c (diff) |
eww: Send notification on new email
-rwxr-xr-x | .config/eww/scripts/email-listener | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/.config/eww/scripts/email-listener b/.config/eww/scripts/email-listener index c205025..71748a7 100755 --- a/.config/eww/scripts/email-listener +++ b/.config/eww/scripts/email-listener @@ -3,20 +3,28 @@ count() { x=`find "$MAILDIR"/*/Inbox/new -type f | wc -l` + case $x in 0) echo 'No New Mail' ;; 1) echo '1 New Mail' + cnt='There is 1 new email' ;; *) printf '%d New Mails\n' $x + cnt="There are $x new emails" ;; esac + + [ $x -gt ${prev:=0} ] && notify-send -a email -u normal 'New Email' \ + "A new unread email has been recieved. $cnt." + prev=$x } count + inotifywait -qm "$MAILDIR"/*/Inbox/new | while read _ event _ do case "$event" in |