helm/themes/pianocat/polybar/modules/updates

23 lines
539 B
Plaintext
Raw Normal View History

2019-08-06 11:29:33 -07:00
#!/usr/bin/env zsh
icon=""
if [[ $1 == "1" ]]; then
echo "%{F#555856}${icon}%{F-}"
exit
fi
pac=$(checkupdates 2>/dev/null | wc -l)
aur=$(yay -Pn 2>/dev/null)
[[ -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"
ding updates
echo "$pac$aur" >/tmp/polybar-updates
fi
else
echo "%{F#555856}${icon}%{F-}"
fi