sb

shitty bar for dwm
git clone git://git.ckyln.com/~cem/sb.git
Log | Files | Refs | README | LICENSE

commit 2f6100195dc764491535b73bea86b0d9f8c666d6
parent c26ed0ba137ed227f2092914546a27df0fbc05ca
Author: Cem Keylan <cem@ckyln.com>
Date:   Tue,  3 Mar 2020 11:19:52 +0300

Change the mail function to not use variables

The new function works like this:
$1: Location of your new mails
$2: (Optional) The name of your account (fallbacks to Mail)

Diffstat:
Mfunc/sb_mail | 8+++++---
Msbrc.example | 8+-------
2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/func/sb_mail b/func/sb_mail @@ -1,7 +1,9 @@ # counts the number of items in the given directory +# $1 New Mail Directory +# $2 Account Name mail() { - [ -z "$NEWMAILDIR" ] && printf "Maildir is not set\\n" >&2 && return 1 - [ "$(find "$NEWMAILDIR" | wc -l)" -gt 1 ] && \ - printf "Mail: $(expr "$(find "$NEWMAILDIR" | wc -l)" - 1) $DELIMITER " + [ -z "$1" ] && printf "Maildir is not set\\n" >&2 && return 1 + [ "$(find "$1" | wc -l)" -gt 1 ] && \ + printf "${2-Mail}: $(expr "$(find "$1" | wc -l)" - 1) $DELIMITER " } diff --git a/sbrc.example b/sbrc.example @@ -7,13 +7,6 @@ # Delimeter. Default: "|" DELIMETER="|" -# New mail directory Default:"" -# E.g. ~/.local/share/mail/account/INBOX/new -# Note: You can also specify your mail directory -# in the command itself. Just do -# NEWMAILDIR="~/.local/share/mail/account/INBOX/new mail" -NEWMAILDIR="" - # Battery name. Default:"BAT0" BATTERY="" @@ -44,4 +37,5 @@ bar() { gethostname sfeed_new "$HOME/.sfeed/main" "Feeds" showmpd + mail /path/to/new/maildir accountname }