Add news polybar module

This commit is contained in:
Thomas Dehaeze 2020-04-02 22:06:18 +02:00
parent 0ba6b68582
commit a6f9ecc90d

View File

@ -80,7 +80,7 @@
modules-left = i3 bspwm xwindow
modules-center =
modules-right = pulseaudio xbacklight redshift wireguard nordvpn lockscreen dunst packages unread_mail temperature battery date
modules-right = pulseaudio xbacklight redshift wireguard nordvpn lockscreen dunst packages unread_news unread_mail temperature battery date
wm-restack = i3
@ -387,6 +387,59 @@
$TERMINAL -e "tmux new-session -A -s neomutt neomutt" &
#+end_src
* Unread News
#+BEGIN_SRC conf
[module/unread_news]
type = custom/script
format-underline = ${colors.bg}
click-left = ~/.config/polybar/scripts/news-open.sh
click-right = ~/.config/polybar/scripts/news-refresh.sh
format = <label>
exec = ~/.config/polybar/scripts/news-status.sh
interval = 60
#+END_SRC
** Unread News Scripts
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/news-status.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
news_nb=`newsboat -x print-unread 2>/dev/null | cut -d " " -f1`
if [ -z "$news_nb" ] || [ "$news_nb" -eq "0" ]; then
echo "";
else
echo "%{F#859900} $news_nb%{F-}";
fi
#+end_src
** Refresh News Scripts
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/news-refresh.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
dunstify --replace=38492 "Newsboat " "Reloading...";
newsboat -x reload && /
news_nb=`newsboat -x print-unread | cut -d " " -f1` && \
dunstify --replace=38492 "Newsboat " "$news_nb Unread News";
#+end_src
** Open Newsboat
:PROPERTIES:
:header-args: :tangle ~/.config/polybar/scripts/news-open.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
$TERMINAL -e "tmux new-session -A -s newsboat newsboat" &
#+end_src
* Redshift
#+BEGIN_SRC conf
[module/redshift]