From 6c200b8850faf51a4d594b3148d3f3913149822b Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Sat, 8 Feb 2020 19:28:25 -0500 Subject: [PATCH] mailbox icon moved to script --- .config/i3blocks/config | 1 - .local/bin/statusbar/mailbox | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.config/i3blocks/config b/.config/i3blocks/config index 393ea86..3694664 100644 --- a/.config/i3blocks/config +++ b/.config/i3blocks/config @@ -34,7 +34,6 @@ interval=18000 signal=5 [mailbox] -label=📬 interval=180 signal=12 diff --git a/.local/bin/statusbar/mailbox b/.local/bin/statusbar/mailbox index 21c85ab..3ace5f5 100755 --- a/.local/bin/statusbar/mailbox +++ b/.local/bin/statusbar/mailbox @@ -13,4 +13,8 @@ case $BLOCK_BUTTON in - Middle click syncs mail" ;; esac -echo "$(du -a ~/.local/share/mail/*/INBOX/new/* 2>/dev/null | sed -n '$=')$(cat /tmp/imapsyncicon_$USER 2>/dev/null)" +unread="$(find ~/.local/share/mail/*/INBOX/new/* -type f | wc -l 2>/dev/null)" + +icon="$(cat "/tmp/imapsyncicon_$USER")" + +[ "$unread" = "0" ] && [ "$icon" = "" ] || echo "📬 $unread$(cat "/tmp/imapsyncicon_$USER" 2>/dev/null)"