diff options
author | InigoGutierrez <inigogf.95@gmail.com> | 2019-11-06 17:10:42 +0100 |
---|---|---|
committer | InigoGutierrez <inigogf.95@gmail.com> | 2019-11-06 17:10:42 +0100 |
commit | 3b90fdadb737e587a5d184e5ec66ee1d68aa5764 (patch) | |
tree | e410edfbf06ccae0ee8c4d077dd3595f1f572248 /i3blocks | |
parent | 42b4dd8a0319a8828e6aea97b847ed554d22f15e (diff) | |
download | scripts-3b90fdadb737e587a5d184e5ec66ee1d68aa5764.tar.gz scripts-3b90fdadb737e587a5d184e5ec66ee1d68aa5764.zip |
Updated and generalized script for i3blocks mail module.
Diffstat (limited to 'i3blocks')
-rwxr-xr-x | i3blocks/i3mailbox.sh | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/i3blocks/i3mailbox.sh b/i3blocks/i3mailbox.sh index 70343c8..213eb6a 100755 --- a/i3blocks/i3mailbox.sh +++ b/i3blocks/i3mailbox.sh @@ -1,6 +1,9 @@ #!/bin/sh -# i3blocks mail module. +# i3mailbox.sh (i3blocks mail module) +# +# Usage: i3mailbox.sh +# # Displays number of unread mail and an loading icon if updating. # When clicked, brings up `neomutt`. @@ -13,11 +16,21 @@ case $BLOCK_BUTTON in - Middle click syncs mail" ;; esac +gmailInbox="$CONFIG_FOLDER_GMAIL_INBOX" +unioviInbox="$CONFIG_FOLDER_UNIOVI_INBOX" +output="" syncIcon="" [ -n "$(pgrep mbsync)" ] && syncIcon="🔃" -gmailN="$(du -a ~/.mail/gmail/INBOX/new/* 2>/dev/null | sed -n '$=')" -[ "$gmailN" ] || gmailN="0" -unioviN="$(du -a ~/.mail/uniovi/INBOX/new/* 2>/dev/null | sed -n '$=')" -[ "$unioviN" ] || unioviN="0" +output="$output$syncIcon" + +if [ -n "$gmailInbox" ]; then + gmailN="$(ls "$gmailInbox"/* 2>/dev/null | wc -l)" + output="$output Gmail: $gmailN " +fi +if [ -n "$unioviInbox" ]; then + unioviN="$(ls "$unioviInbox"/* 2>/dev/null | wc -l)" + output="$output Uniovi: $unioviN " +fi + #echo "$(cat /tmp/imapsyncicon) Gmail: $gmailN uniovi: $unioviN" -echo "$syncIcon Gmail: $gmailN uniovi: $unioviN" +echo "${output% }" |