blob: f8e3181889b340d57b69280105eeecbdf0452e3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#!/bin/sh
# Set as a cron job to check for new RSS entries for newsboat.
# If newsboat is open, sends it an "R" key to refresh.
# Bail if a previous run is still going. With the fulltext filter a reload now
# takes ~17s+, so back-to-back cron ticks could overlap: a second `-x reload`
# can't grab the cache.db lock, and the rm/signal races blank the status bar.
exec 9>/tmp/newsup.lock
flock -n 9 || exit
/usr/bin/notify-send "📰 Updating RSS feeds..."
pgrep -x newsboat && /usr/bin/xdotool key --window "$(/usr/bin/xdotool search --name "^newsboat$")" R && exit
echo "📰$(/usr/bin/newsboat -x print-unread | awk '{print $1}')🔃" >/tmp/newsupdate
pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}"
/usr/bin/newsboat -x reload
rm -f /tmp/newsupdate
pkill -RTMIN+14 "${STATUSBAR:-dwmblocks}"
/usr/bin/notify-send "📰 RSS feed update complete."
|