polybar: hide recycling collection indicator when no collection today or

tomorrow
main
maia arson crimew 2022-06-05 12:56:50 +02:00
parent 71640dfd58
commit e07aaedfef
1 changed files with 7 additions and 0 deletions

View File

@ -30,9 +30,16 @@ data="$(curl -s "https://www.real.sammelkalender.ch/app/appSammeldaten.php?nGem=
collection_today="$(echo "$data" | jq -r ".[] | select(.DATUM == \"$today\") | .AbarOne")" collection_today="$(echo "$data" | jq -r ".[] | select(.DATUM == \"$today\") | .AbarOne")"
collection_tomorrow="$(echo "$data" | jq -r ".[] | select(.DATUM == \"$tomorrow\") | .AbarOne")" collection_tomorrow="$(echo "$data" | jq -r ".[] | select(.DATUM == \"$tomorrow\") | .AbarOne")"
has_printed=0
if [[ "$collection_today" != "null" ]]; then if [[ "$collection_today" != "null" ]]; then
format_collections $collection_today format_collections $collection_today
has_printed=1
fi fi
if [[ "$collection_tomorrow" != "null" ]]; then if [[ "$collection_tomorrow" != "null" ]]; then
echo "tomorrow: $(format_collections $collection_tomorrow)" echo "tomorrow: $(format_collections $collection_tomorrow)"
has_printed=1
fi
# hide the module
if [[ "$has_printed" == "0" ]]; then
echo ""
fi fi