all repos — dotfiles @ bcfc0f1df8bc96daf0c3701b392451c2ba5bea62

linux dotfiles

bin/cron/newsboat-cron

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#!/bin/sh

ping -q -c 1 google.com >/dev/null || exit
pgrep -x newsboat >/dev/null && xdotool key --window "$(xdotool search --name newsboat)" R && exit
count=0
echo -e '\uf2f1' > $HOME/.config/newsboat/unread && pkill -SIGRTMIN+10 i3blocks 
count=$(newsboat -x "reload" && newsboat -x "print-unread" | cut -d ' ' -f1)

if [ $count -gt 0 ]
then
    echo $count > $HOME/.config/newsboat/unread
    pkill -SIGRTMIN+10 i3blocks
    notify-send -i feedreader "$count unread RSS feeds"
elif [ $count -eq 0 ]
then
    echo $count > $HOME/.config/newsboat/unread
    pkill -SIGRTMIN+10 i3blocks
fi