From c52cc66ff962248be06f9169d8e646912ee7f393 Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Sun, 5 Jul 2026 10:29:04 +0200 Subject: [PATCH] fix(archupdates): human-readable last patch date --- home/oli/bin/i3blocks/archupdates | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/home/oli/bin/i3blocks/archupdates b/home/oli/bin/i3blocks/archupdates index 0fd54be..5783f35 100755 --- a/home/oli/bin/i3blocks/archupdates +++ b/home/oli/bin/i3blocks/archupdates @@ -27,7 +27,12 @@ pkgupdate() { local fg=$warn2_fg fi fi - local stat="$pkgcount pkg updates (last update: $hours_since_last_patched hours ago)" + if ((hours_since_last_patched >= 24)); then + local time_str="$(awk "BEGIN {printf \"%.1f\", int($hours_since_last_patched / 24 * 2 + 0.5) / 2}")d" + else + local time_str="${hours_since_last_patched}h" + fi + local stat="$pkgcount pkg updates (last update: ${time_str} ago)" if [[ -n "$bg" ]]; then echo -e "$stat\n"