Add right click to refresh mails/packages

This commit is contained in:
Thomas Dehaeze 2020-04-02 22:06:26 +02:00
parent c3b8bb7b56
commit 520729eecf

View File

@ -356,6 +356,7 @@
format-underline = ${colors.bg} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/mail-open.sh click-left = ~/.config/polybar/scripts/mail-open.sh
click-right = ~/.config/polybar/scripts/mail-refresh.sh
format = <label> format = <label>
exec = ~/.config/polybar/scripts/mail-status.sh exec = ~/.config/polybar/scripts/mail-status.sh
interval = 1 interval = 1
@ -377,6 +378,21 @@
fi fi
#+end_src #+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 ** Open Mails
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/mail-open.sh :header-args: :tangle ~/.config/polybar/scripts/mail-open.sh
@ -534,6 +550,7 @@
format-underline = ${colors.bg} format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/packages-update.sh click-left = ~/.config/polybar/scripts/packages-update.sh
click-right = ~/.config/polybar/scripts/packages-refresh.sh
format = <label> format = <label>
exec = ~/.config/polybar/scripts/packages-status.sh exec = ~/.config/polybar/scripts/packages-status.sh
interval = 600 interval = 600
@ -556,6 +573,24 @@
fi fi
#+END_SRC #+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 ** Packages Update
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/packages-update.sh :header-args: :tangle ~/.config/polybar/scripts/packages-update.sh