2021-05-07 22:49:21 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
MAILDIR=$HOME/.mail
|
|
|
|
ACCOUNTS=(posteo gmail xkonni)
|
|
|
|
|
|
|
|
text=""
|
2021-05-13 23:48:21 +02:00
|
|
|
tooltip=""
|
2021-05-07 22:49:21 +02:00
|
|
|
total=0
|
|
|
|
for acc in ${ACCOUNTS[@]}; do
|
|
|
|
count=$(notmuch count folder:$acc/Inbox AND tag:unread AND NOT tag:killed)
|
|
|
|
total=$((total+count))
|
2021-05-13 23:48:21 +02:00
|
|
|
tooltip+="$acc: $count"
|
|
|
|
[ ! $acc = ${ACCOUNTS[-1]} ] && tooltip+="\n"
|
2021-05-07 22:49:21 +02:00
|
|
|
done
|
|
|
|
|
|
|
|
alt=$( [ $total -gt 0 ] && echo "unread" || echo "read" )
|
2021-05-13 23:48:21 +02:00
|
|
|
text="$total"
|
|
|
|
json="{\"text\": \"$text\", \"tooltip\": \"$tooltip\", \"class\": \"mail\", \"alt\": \"$alt\"}"
|
2021-05-07 22:49:21 +02:00
|
|
|
echo $json
|