2017-12-05 22:39:10 -08:00
|
|
|
#!/usr/bin/env zsh
|
|
|
|
icon=""
|
|
|
|
if [[ $1 == "1" ]]; then
|
|
|
|
echo "%{F#555856}${icon}%{F-}"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2018-05-24 12:35:12 -07:00
|
|
|
pac=$(checkupdates 2>/dev/null | wc -l)
|
|
|
|
aur=$(yay -Pn 2>/dev/null)
|
2017-12-05 22:39:10 -08:00
|
|
|
|
|
|
|
[[ -f /tmp/polybar-updates ]] && last=$(</tmp/polybar-updates)
|
|
|
|
check=$((pac + aur))
|
|
|
|
if [[ "$check" != "0" ]]; then
|
|
|
|
echo "%{F#b5bd68}${icon}$pac+$aur%{F-}"
|
|
|
|
if [[ $last != "$pac$aur" ]]; then
|
|
|
|
notify-send "$((pac+aur)) updates available"
|
2017-12-08 09:41:30 -08:00
|
|
|
ding updates
|
2017-12-05 22:39:10 -08:00
|
|
|
echo "$pac$aur" >/tmp/polybar-updates
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "%{F#555856}${icon}%{F-}"
|
|
|
|
fi
|