From f25cfe4776c78ce9b705fa7e9655758205af29a4 Mon Sep 17 00:00:00 2001 From: Pavel Fadeev Date: Thu, 29 Jan 2026 12:54:13 +0100 Subject: [PATCH] Fix break reminder showing malformed "Next:" output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Check meeting is in future (> now_ms) not just non-zero - Omit "Next:" suffix entirely when no upcoming meeting - Fallback title to "meeting" if calendar entry has empty title - Clean output: "☕ 771m focus. Break?" or with meeting: "☕ 771m focus. Break? Next: Standup in 45m" Fixes issue where stale/past meetings caused "Next: nothing in ∞m" --- .../claude-status-hub/bin/refresh-daemon.sh | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/plugins/claude-status-hub/bin/refresh-daemon.sh b/plugins/claude-status-hub/bin/refresh-daemon.sh index c580ae9..b17620a 100755 --- a/plugins/claude-status-hub/bin/refresh-daemon.sh +++ b/plugins/claude-status-hub/bin/refresh-daemon.sh @@ -61,18 +61,25 @@ check_focus_break() { # Check for gap before next meeting (need at least 15 min) local next_meeting_start=$(jq -r '.calendar.lastSeen[0].startTime // 0' "$CONFIG" 2>/dev/null) - if [ "$next_meeting_start" -gt 0 ]; then + local next_suffix="" + + if [ "$next_meeting_start" -gt "$now_ms" ]; then + # Meeting is in the future local min_until_meeting=$(( (next_meeting_start - now_ms) / 60000 )) - [ "$min_until_meeting" -ge 15 ] || return 0 + if [ "$min_until_meeting" -ge 15 ]; then + local next_title=$(jq -r '.calendar.lastSeen[0].title // ""' "$CONFIG" 2>/dev/null) + [ -z "$next_title" ] && next_title="meeting" + next_suffix=" Next: ${next_title} in ${min_until_meeting}m" + else + # Meeting too soon - skip break reminder + return 0 + fi fi - - # Trigger break reminder alert - local next_title=$(jq -r '.calendar.lastSeen[0].title // "nothing"' "$CONFIG" 2>/dev/null) - local min_until=${min_until_meeting:-"∞"} + # No meeting or meeting is far enough away - show break reminder # Update bridge with focus break alert if [ -f "$BRIDGE" ]; then - local alert_text="☕ ${duration_min}m focus. Break? Next: ${next_title} in ${min_until}m" + local alert_text="☕ ${duration_min}m focus. Break?${next_suffix}" jq --arg alert "$alert_text" \ '.foreground = [{"service": "focus", "icon": "☕", "title": "Break reminder", "detail": $alert, "hasAlert": true}] + .foreground' \ "$BRIDGE" > "${BRIDGE}.tmp" && mv "${BRIDGE}.tmp" "$BRIDGE"