waybar: use default config for most hosts, add mail status

This commit is contained in:
Konstantin Koslowski 2021-05-07 22:49:21 +02:00
parent 4939e65708
commit b4b0adf131
6 changed files with 52 additions and 286 deletions

18
bin/mail Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
MAILDIR=$HOME/.mail
ACCOUNTS=(posteo gmail xkonni)
text=""
total=0
for acc in ${ACCOUNTS[@]}; do
count=$(notmuch count folder:$acc/Inbox AND tag:unread AND NOT tag:killed)
total=$((total+count))
text+="$count"
[ ! $acc = ${ACCOUNTS[-1]} ] && text+=", "
done
alt=$( [ $total -gt 0 ] && echo "unread" || echo "read" )
text="$total ($text)"
json="{\"text\": \"$text\", \"class\": \"mail\", \"alt\": \"$alt\"}"
echo $json