aboutsummaryrefslogtreecommitdiff
path: root/config/i3blocks/scripts/email
diff options
context:
space:
mode:
Diffstat (limited to 'config/i3blocks/scripts/email')
-rwxr-xr-xconfig/i3blocks/scripts/email23
1 files changed, 18 insertions, 5 deletions
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"