When integrated with Waybar, this script returns the number of OS updates.
As an example, the returned text below shows that no updates are available.
{“text”:“ “,“tooltip”:“No updates”,“class”:“unmuted”}
!/usr/bin/env bash
OS=$(cat /etc/os-release | grep "^NAME" | sed -E 's/^NAME=("?)(.+)("?)/\2/' | tail -1)
NUM=0;
if [[ $OS =~ "Void" ]]; then
NUM=$(xbps-install -nuM | wc -l)
elif [[ $OS == "ArcoLinux" ]]; then
NUM=$(checkupdates | wc -l)
fi
if [ "$NUM" -gt 0 ]; then
echo '{"text":"{" '$NUM'","tooltip":"Updates available","class":"unmuted"}'
else
echo '{"text":" ","tooltip":"No updates","class":"unmuted"}'
fi