aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/barmailstatus
diff options
context:
space:
mode:
authorYaroslav <contact@yaroslavps.com>2020-04-09 01:30:04 +0300
committerYaroslav <contact@yaroslavps.com>2020-04-09 01:30:04 +0300
commitd5c97e78d80177119421f9dade324b04f2b00126 (patch)
tree7a637bf2a8ea613f7480301434e778ad6d8b6f42 /dotfiles/.local/bin/barmailstatus
parent2a7d8cecace432898722b0d2c7a2543e1057cf74 (diff)
downloadswayrice-d5c97e78d80177119421f9dade324b04f2b00126.tar.gz
swayrice-d5c97e78d80177119421f9dade324b04f2b00126.zip
mail scripts for aerc+mbsync; goodbye neomutt
Diffstat (limited to 'dotfiles/.local/bin/barmailstatus')
-rwxr-xr-xdotfiles/.local/bin/barmailstatus14
1 files changed, 14 insertions, 0 deletions
diff --git a/dotfiles/.local/bin/barmailstatus b/dotfiles/.local/bin/barmailstatus
new file mode 100755
index 0000000..d40a73d
--- /dev/null
+++ b/dotfiles/.local/bin/barmailstatus
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+total=0
+
+# Check all accounts/mailboxes for new mail.
+for mailbox in "$HOME/.local/share/mail/"*
+do
+ account="$(echo "$mailbox" | sed "s/.*\///")"
+ newcount=$(find "$HOME/.local/share/mail/$account/INBOX/new/" "$HOME/.local/share/mail/$account/Inbox/new/" "$HOME/.local/share/mail/$account/inbox/new/" -type f 2> /dev/null | wc -l)
+ total=$((total + newcount))
+done
+
+[ $total -gt 0 ] && echo "$total"
+