Merge all notifications

Notification for kernel update is included in the same notification as
everything else, no more a separate one
This commit is contained in:
Daniele Fucini
2026-10-04 16:19:16 +02:00
parent 0416d3e615
commit 87bd9ad512
+23 -11
View File
@@ -93,29 +93,37 @@ updates=$((arch_updates + aur_updates))
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Kernel check: the stock kernel updated, but your custom build didn't # Kernel check: the stock kernel updated, but your custom build didn't
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
kernel_lines=()
for stock_pkg in "${!KERNELS[@]}"; do for stock_pkg in "${!KERNELS[@]}"; do
custom_pkg=${KERNELS[$stock_pkg]} custom_pkg=${KERNELS[$stock_pkg]}
# Skip kernels where either package isn't installed # Skip kernels where either package isn't installed
if ! stock_ver=$(latest_version "$stock_pkg") || ! custom_ver=$(latest_version "$custom_pkg"); then if ! stock_ver=$(latest_version "$stock_pkg") || ! custom_ver=$(latest_version "$custom_pkg"); then
clear_state "kernel-$stock_pkg"
continue continue
fi fi
# Notify while the stock kernel is newer than the newest custom build # Flag the kernel while the stock one is newer than the newest custom build
# (installed, or already built into your repo but not yet installed) # (installed, or already built into your repo but not yet installed)
if (( $(vercmp "$stock_ver" "$custom_ver") > 0 )); then if (( $(vercmp "$stock_ver" "$custom_ver") > 0 )); then
notify_once "kernel-$stock_pkg" "Kernel update available: $stock_pkg" \ kernel_lines+=("Rebuild $custom_pkg ($stock_pkg $stock_ver)")
"Rebuild $custom_pkg ($stock_pkg $stock_ver)"
else
clear_state "kernel-$stock_pkg"
fi fi
done done
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# General updates threshold # Build a single notification
# - kernel rebuild lines are always included
# - update counts and reminders only when the threshold is reached
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
if (( updates >= threshold )); then over_threshold=0
(( updates >= threshold )) && over_threshold=1
parts=()
if (( over_threshold )); then
parts+=("Arch: $arch_updates, AUR: $aur_updates")
fi
parts+=("${kernel_lines[@]}")
if (( over_threshold )); then
reminders=() reminders=()
# Always remind about git packages if git-monitor is installed # Always remind about git packages if git-monitor is installed
@@ -133,13 +141,17 @@ if (( updates >= threshold )); then
fi fi
fi fi
body="Arch: $arch_updates, AUR: $aur_updates"
if (( ${#reminders[@]} )); then if (( ${#reminders[@]} )); then
printf -v list '%s, ' "${reminders[@]}" printf -v list '%s, ' "${reminders[@]}"
body+=$'\n'"Also check: ${list%, }" parts+=("Also check: ${list%, }")
fi fi
fi
notify_once "updates" "Updates available" "$body" if (( ${#parts[@]} )); then
title="Updates available"
(( over_threshold )) || title="Kernel update available"
printf -v body '%s\n' "${parts[@]}"
notify_once "updates" "$title" "${body%$'\n'}"
else else
clear_state "updates" clear_state "updates"
fi fi