#!/usr/bin/env bash

updates=$(sysupdate)

if [ -z "$updates" ]; then
  count=0
else
  printf '%s\n' "$updates" >/tmp/bspwm-polybar-updates
  count=$(wc -l "/tmp/bspwm-polybar-updates" | awk '{print $1}')
fi

echo "%{T1}%{T-} %{T2}$count %{T-}"
