From f8f96d4dd74aa6cbdcc6763e5efc9c1393f1ebea Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Wed, 25 Jan 2023 12:50:30 +0100 Subject: [PATCH] Properly handle 'All caught up!' output from gh-notify --- home/.local/bin/scripts/gui/gh-notification | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/home/.local/bin/scripts/gui/gh-notification b/home/.local/bin/scripts/gui/gh-notification index 1f47f51..2a43520 100755 --- a/home/.local/bin/scripts/gui/gh-notification +++ b/home/.local/bin/scripts/gui/gh-notification @@ -190,6 +190,12 @@ send_notify() { # Request unread notifications with gh-notify extension for github-cli [ "$ALL" -eq 1 ] && out="$(gh notify -s -a -n "$MAX_AMOUNT")" || out="$(gh notify -s -n "$MAX_AMOUNT")" +# When no notifications were found, set output to empty string, to avoid 'All caught up!' line +# being treated as notification +if [ "$out" == "All caught up!" ]; then + out="" +fi + total="$(printf "%s\n" "$out" | wc -l)" # Since we always end with a newline (to count the last entry as a line), we always get # at least 1 as a total here, even if $out is empty. If we didn't use the \n, we'd always