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-left = i3 bspwm xwindow
modules-center = 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 wm-restack = i3
@ -377,8 +377,7 @@
[module/unread_mail] [module/unread_mail]
type = custom/script type = custom/script
label-font = 2 :format-underline = ${colors.bg}
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/mail-open.sh click-left = ~/.config/polybar/scripts/mail-open.sh
format = <label> format = <label>
exec = ~/.config/polybar/scripts/mail-status.sh exec = ~/.config/polybar/scripts/mail-status.sh
@ -392,12 +391,12 @@
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+begin_src bash #+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 if [ "$mail_nb" -eq "0" ]; then
echo "" echo "";
else else
echo "%{F#859900}%{F-}" echo "%{F#859900} $mail_nb%{F-}";
fi fi
#+end_src #+end_src
@ -519,11 +518,12 @@
:header-args+: :shebang "#!/usr/bin/env bash" :header-args+: :shebang "#!/usr/bin/env bash"
:END: :END:
#+BEGIN_SRC bash #+BEGIN_SRC bash
packagenb=`yay -Qu 2> /dev/null | wc -l`; package_nb=`yay -Qu 2> /dev/null | wc -l`;
if [ "$packagenb" -eq "0" ]; then
if [ "$package_nb" -eq "0" ]; then
echo ""; echo "";
else else
echo "%{F#859900} $packagenb%{F-}"; echo "%{F#859900} $package_nb%{F-}";
fi fi
#+END_SRC #+END_SRC