From cc893abdc9c5112d2f9831901b99d086f0bde2ed Mon Sep 17 00:00:00 2001 From: Viyurz Date: Sat, 15 Jun 2024 13:18:47 +0200 Subject: [PATCH] Waybar packages updates: Show only first 25 packages. --- .config/waybar/pkg-update-count.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.config/waybar/pkg-update-count.sh b/.config/waybar/pkg-update-count.sh index fbea80e..ee94229 100755 --- a/.config/waybar/pkg-update-count.sh +++ b/.config/waybar/pkg-update-count.sh @@ -14,9 +14,13 @@ while [[ $retry_count -le $max_retries && $success -ne 1 ]]; do case $? in # Update(s) available 0) + max_shown=25 success=1 output=$(echo "$cmd_res" | wc -l) - tooltip="$(echo "$cmd_res" | sed -z 's/\n/\\n/g' | sed 's/\\n$//')" + tooltip="$(echo "$cmd_res" | head -n "$max_shown" | sed -z 's/\n/\\n/g' | sed 's/\\n$//')" + if [[ $output -gt $max_shown ]]; then + tooltip="$tooltip\n[..] +$((output - max_shown))" + fi class="update-available" ;;