dotfiles/.config/polybar/scripts/updates-arch-combined.sh

18 lines
545 B
Bash
Executable File

#!/bin/sh
source $(dirname $0)/../.env
connect=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` &> /dev/null)
if [ $? -eq 0 ]; then
updates_arch=$(/usr/bin/checkupdates | wc -l)
# a restricts to AUR packages
updates_aur=$(yay -Qua | wc -l)
updates=$(("$updates_arch" + "$updates_aur"))
if [ "$updates" -gt 0 ]; then
echo "%{F$MOCHA_MAUVE}%{F$MOCHA_TEXT} $updates_arch | $updates_aur"
else
echo "%{F$MOCHA_GREEN}%{F$MOCHA_TEXT} 0"
fi
else
echo "%{F#77dd77}%{F#ddd} Offline"
fi