From b147e764e6278f34f338de58cb2a51f3c54f42cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 23 Nov 2020 22:41:06 +0100 Subject: Switch away from mutt to notmuch --- config/i3blocks/scripts/email | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'config') diff --git a/config/i3blocks/scripts/email b/config/i3blocks/scripts/email index 2d26280..d2213e0 100755 --- a/config/i3blocks/scripts/email +++ b/config/i3blocks/scripts/email @@ -1,6 +1,19 @@ -#!/bin/sh -# Note: we cut last character because output ends with new line -OUT="$(email-unread -s | tr "\n" " " | sed 's/ $//')" -echo "$OUT" -echo "$OUT" +#!/bin/bash +filter=("tag:unread" "and" "not" "tag:killed") + +part=() +all=0 +for mail in email gmail nic fel; do + counts="$(notmuch count -- "${filter[@]}" and "tag:$mail")" + [ "$counts" = "0" ] || \ + part+=("$mail:$counts") + ((all = all + counts)) +done + +echo "${part[@]}" +if [ "$all" = "0" ]; then + echo +else + echo "mails:$all" +fi echo "#ffff00" -- cgit v1.2.3