From c3035cb45ea59c7bb068ef8b95125a70b3ff539a Mon Sep 17 00:00:00 2001 From: Konstantin Koslowski Date: Fri, 14 May 2021 22:39:50 +0200 Subject: [PATCH] waybar: add service status to mail --- bin/waybar_mail.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/waybar_mail.sh b/bin/waybar_mail.sh index 9597a68..93b3491 100755 --- a/bin/waybar_mail.sh +++ b/bin/waybar_mail.sh @@ -2,17 +2,24 @@ MAILDIR=$HOME/.mail ACCOUNTS=(posteo gmail xkonni) +SERVICES=(mbsync@ykonni muchsync@ykonni) + text="" -tooltip="" +tooltip="accounts\n" total=0 for acc in ${ACCOUNTS[@]}; do count=$(notmuch count folder:$acc/Inbox AND tag:unread AND NOT tag:killed) total=$((total+count)) - tooltip+="$acc: $count" - [ ! $acc = ${ACCOUNTS[-1]} ] && tooltip+="\n" + tooltip+=" - $acc: $count\n" done +tooltip+="\nservices\n" +for service in ${SERVICES[@]}; do + tooltip+=" - $service:\n$(systemctl --user status $service | grep -e 'Active' | sed 's/Active:[ ]*//g')\n" +done + + alt=$( [ $total -gt 0 ] && echo "unread" || echo "read" ) text="$total" json="{\"text\": \"$text\", \"tooltip\": \"$tooltip\", \"class\": \"mail\", \"alt\": \"$alt\"}"