display newest unread article title if one is found

This commit is contained in:
Alexander Bocken 2021-05-11 18:12:41 +02:00
parent 222659f325
commit ec84b00705
Signed by: Alexander
GPG Key ID: 1D237BE83F9B05E8
2 changed files with 8 additions and 1 deletions

View File

@ -4,7 +4,7 @@ reload-threads 100
external-url-viewer "newsboat_urlscan {}" external-url-viewer "newsboat_urlscan {}"
notify-program "/usr/bin/notify-send" notify-program "/home/alex/.local/bin/newsboatnotifs"
notify-format "%d new articles (%n unread articles, %f unread feeds)" notify-format "%d new articles (%n unread articles, %f unread feeds)"
bind-key j down bind-key j down

7
.local/bin/newsboatnotifs Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
CACHE="${XDG_DATA_HOME:-$HOME/.local/share}/newsboat/cache.db"
unread="$(sqlite3 "$CACHE" "SELECT unread,pubDate,title FROM rss_item;" |
grep -vE '^0' | sort -t'|' -k2 -g | head -n1 |
sed 's/[0-9]*|[0-9]*|//')"
notify-send "newsboat" "$(printf 'new article:\n %s' "$unread")"