Add number of new mails

This commit is contained in:
Thomas Dehaeze 2020-03-19 15:20:33 +01:00
parent fa7ab9f54a
commit 6764c1a683

View File

@ -80,7 +80,7 @@
modules-left = i3 bspwm xwindow
modules-center =
modules-right = pulseaudio xbacklight redshift packages nordvpn lockscreen dunst unread_mail cpu battery temperature date
modules-right = pulseaudio xbacklight redshift nordvpn lockscreen dunst packages unread_mail cpu battery temperature date
wm-restack = i3
@ -377,8 +377,7 @@
[module/unread_mail]
type = custom/script
label-font = 2
format-underline = ${colors.bg}
:format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/mail-open.sh
format = <label>
exec = ~/.config/polybar/scripts/mail-status.sh
@ -392,12 +391,12 @@
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
mails=$(du -a ~/.mail/*/Inbox/new/* 2>/dev/null | sed -n '$=')
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l`
if [[ -z "$mails" ]]; then
echo ""
if [ "$mail_nb" -eq "0" ]; then
echo "";
else
echo "%{F#859900}%{F-}"
echo "%{F#859900} $mail_nb%{F-}";
fi
#+end_src
@ -519,11 +518,12 @@
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
packagenb=`yay -Qu 2> /dev/null | wc -l`;
if [ "$packagenb" -eq "0" ]; then
package_nb=`yay -Qu 2> /dev/null | wc -l`;
if [ "$package_nb" -eq "0" ]; then
echo "";
else
echo "%{F#859900} $packagenb%{F-}";
echo "%{F#859900} $package_nb%{F-}";
fi
#+END_SRC