aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/i3status/.local/bin/rss-status
blob: a404a3b3ba6bf364858c2501830b9b5c78903cf2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh
# shellcheck disable=SC2046

set -e

sleep 1

if [ $# -eq 0 ]; then
	set -- $(curl -sH "X-Auth-Token: ${MINIFLUX_TOKEN:-$(pass miniflux.tobyvin.dev/i3status)}" https://miniflux.tobyvin.dev/v1/feeds/counters |
		jq -r '[.unreads[]] | add // 0 | [., (if . > 50 then "critical" elif . > 0 then "warning" else "idle" end), "rss"] | .[]')
fi

busctl --user call rs.i3status /rss rs.i3status.custom SetText ss "${1:-0}" "${1:-0}"
busctl --user call rs.i3status /rss rs.i3status.custom SetState s "${2:-idle}"
busctl --user call rs.i3status /rss rs.i3status.custom SetIcon s "${3:-rss}"