2021-05-07 22:49:21 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
MAILDIR=$HOME/.mail
|
|
|
|
ACCOUNTS=(posteo gmail xkonni)
|
2021-05-14 22:39:50 +02:00
|
|
|
SERVICES=(mbsync@ykonni muchsync@ykonni)
|
|
|
|
|
2021-05-07 22:49:21 +02:00
|
|
|
|
|
|
|
text=""
|
2021-05-14 22:39:50 +02:00
|
|
|
tooltip="<b>accounts</b>\n"
|
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-14 22:39:50 +02:00
|
|
|
tooltip+=" - $acc: $count\n"
|
|
|
|
done
|
|
|
|
|
|
|
|
tooltip+="\n<b>services</b>\n"
|
|
|
|
for service in ${SERVICES[@]}; do
|
|
|
|
tooltip+=" - $service:\n$(systemctl --user status $service | grep -e 'Active' | sed 's/Active:[ ]*//g')\n"
|
2021-05-07 22:49:21 +02:00
|
|
|
done
|
|
|
|
|
2021-05-14 22:39:50 +02:00
|
|
|
|
2021-05-07 22:49:21 +02:00
|
|
|
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
|