dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

newsrefreshd (599B)


      1 #!/bin/sh
      2 # This script refreshes newsboat. Runs via a LaunchAgent or cronjob.
      3 set -e
      4 
      5 notidie() {
      6   notify "$1" "$2" news
      7   exit 1
      8 }
      9 
     10 os=$(uname -s | tr '[:upper:]' '[:lower:]')
     11 case "$os" in
     12   darwin*)
     13     while pgrep RotMG; do sleep 60; done
     14     while pgrep pinentry; do sleep 60; done
     15     ;;
     16 esac
     17 
     18 unreadbefore="$(newsboat -x print-unread | cut -d' ' -f1)"
     19 newsboat -x reload 2>&1 || notidie "Newsboat: error reloading" "Unable to reload"
     20 unreadafter="$(newsboat -x print-unread | cut -d' ' -f1)"
     21 notify 'Newsboat reloaded' "$((unreadafter-unreadbefore)) new articles ($unreadafter total)" news