From 21298dd73da954bc93596374ce3b485e70065a51 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Sun, 5 Apr 2020 11:28:40 +0200 Subject: [PATCH] Reload news while newsboat is runing --- dotfiles/polybar.org | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dotfiles/polybar.org b/dotfiles/polybar.org index 991e34a..6f1b5cf 100644 --- a/dotfiles/polybar.org +++ b/dotfiles/polybar.org @@ -439,11 +439,12 @@ :header-args+: :shebang "#!/usr/bin/env bash" :END: #+begin_src bash - if pgrep -x "newsboat" >/dev/null; then - dunstify --replace=38492 "Newsboat " "Already running"; - else - dunstify --replace=38492 "Newsboat " "Reloading..."; + dunstify --replace=38492 "Newsboat " "Reloading..."; + if pgrep -x "newsboat" >/dev/null; then + # If newsboat is already running, try to refresh in the tmux session + tmux send-keys -t newsboat R + else newsboat -x reload && / news_nb=`newsboat -x print-unread | cut -d " " -f1` && \ dunstify --replace=38492 "Newsboat " "$news_nb Unread News";