#!/usr/bin/env bash
# updates.sh — polybar module: count of pending apt upgrades (empty when none).
# Modeled on the other custom/script modules (target.sh, vpn.sh). Best-effort:
# uses the cached apt index (no sudo, no network) so it's cheap to poll.
n=$(apt-get -s upgrade 2>/dev/null | grep -c '^Inst')
[ "${n:-0}" -gt 0 ] && printf '%s\n' "$n" || printf '\n'