Fully rewrite without text and more colors

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-12-11 17:16:04 +01:00
parent 5fe15aeef4
commit b6542d1f7e
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -16,9 +16,19 @@ function get_grep() {
updates=$(checkupdates) updates=$(checkupdates)
num=$(echo "${updates}" | grep -c -- '->') num=$(echo "${updates}" | grep -c -- '->' || true)
req_restart="" # No updates: Gray
echo "${updates}" | grep -qE "^($(get_grep)) " && req_restart=' <span color="#dd0000">(reboot)</span>' color="#7f7f7f"
display_num=""
printf "\uf94f %d %s%s" $num $(${HOME}/bin/pluralize Update $num) "${req_restart}" # Normal updates: White
[ $num -gt 0 ] && {
color="#ffffff"
display_num="${num}"
}
# Requires reboot: Red
(echo "${updates}" | grep -qE "^($(get_grep))") && color="#dd0000"
printf '<span color="%s">\uf94f %s</span>' "${color}" "${display_num}"