aboutsummaryrefslogtreecommitdiff
path: root/config/i3blocks/scripts/email
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2020-11-23 22:41:06 +0100
committerKarel Kočí <cynerd@email.cz>2020-11-23 22:41:06 +0100
commitb147e764e6278f34f338de58cb2a51f3c54f42cd (patch)
tree8f2c50a895c81d2aee6dd6fe8dda118607120602 /config/i3blocks/scripts/email
parent2cae2a1cdfe0083aa0d4ad86ee9f32248b193938 (diff)
downloadmyconfigs-b147e764e6278f34f338de58cb2a51f3c54f42cd.tar.gz
myconfigs-b147e764e6278f34f338de58cb2a51f3c54f42cd.tar.bz2
myconfigs-b147e764e6278f34f338de58cb2a51f3c54f42cd.zip
Switch away from mutt to notmuch
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"