Add right click to refresh mails/packages

This commit is contained in:
Thomas Dehaeze 2020-04-02 22:06:26 +02:00
parent a6f9ecc90d
commit e20cb00b9b

View File

@ -356,6 +356,7 @@
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/mail-open.sh
click-right = ~/.config/polybar/scripts/mail-refresh.sh
format = <label>
exec = ~/.config/polybar/scripts/mail-status.sh
interval = 1
@ -377,6 +378,21 @@
fi
#+end_src
** Refresh Mail Scripts
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/mail-refresh.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
dunstify --replace=98465 "Mails " "Syncing...";
~/scripts/checkmail.sh -q && \
mail_nb=`du -a ~/.mail/*/Inbox/new/* 2>/dev/null | wc -l` && \
if [ "$mail_nb" -eq "0" ]; then
dunstify --replace=98465 "Mails " "No new mail";
fi
#+end_src
** Open Mails
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/mail-open.sh
@ -534,6 +550,7 @@
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/packages-update.sh
click-right = ~/.config/polybar/scripts/packages-refresh.sh
format = <label>
exec = ~/.config/polybar/scripts/packages-status.sh
interval = 600
@ -556,6 +573,24 @@
fi
#+END_SRC
** Refresh New Packages script
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/packages-refresh.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+BEGIN_SRC bash
dunstify --replace=64654 'Packages ' "Refreshing..."
yay -Sy > /dev/null 2>&1 && \
package_nb=`yay -Qu 2> /dev/null | wc -l`;
if [ "$package_nb" -eq "0" ]; then
dunstify --replace=64654 'Packages ' "No upgrade available"
else
dunstify --replace=64654 'Packages ' "$(package_nb) upgrade(s) available"
fi
#+END_SRC
** Packages Update
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/packages-update.sh