helm/themes/pianocat/polybar/modules/updates
2019-08-06 14:29:33 -04:00

23 lines
539 B
Bash
Executable file

#!/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