~sircmpwn/dotfiles

ref: 0952c8392b47791670e378491a5cc6f9c99c9729 dotfiles/bin/custom_statusbar -rwxr-xr-x 848 bytes View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
. ~/.config/stewdio.conf
while true
do
	listeners=$(curl -s https://$upstream/api/listeners)
	nlisteners=$(printf '%s' "$listeners" | jq -r '.named_listeners | length')
	listeners=$(printf '%s' "$listeners" | jq -r '.named_listeners | join(", ")')
	now_playing=$(curl -s https://$upstream/api/playing | jq -r '.artist + " - " + .title')
	kotd=$(kotd)
	ibus=$(ibus engine 2> /dev/null)
	time=$(date +"%A %Y-%m-%d %I:%M %p")
	time="$time $(date -u +"(%H:%M UTC)")"

	if [ "${ibus}" == "anthy" ]
	then
		ibus=" ⋯ JA"
	elif [ "${ibus}" == "Unikey" ]
	then
		ibus=" ⋯ VT"
	else
		ibus=""
	fi

	if [ "${nlisteners}" -gt 0 ]
	then
		printf "${kotd} ⋯ ♫ %s w/%s ⋯ %s%s" "${now_playing}" "${listeners}" "${time}" "${ibus}"
	else
		printf "${kotd} ⋯ ♫ %s ⋯ %s%s" "${now_playing}" "${time}" "${ibus}"
	fi
	printf "\n"
	sleep 10
done