From ce97dd5d68dfca687db0bdcd5adb6add6ed45e50 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:29 +0100 Subject: fix(waybar): mako-status counts ids by parsing text dump Same root cause as 3205afc: this makoctl version has no -f flag, so the '%i' lookup silently produced no ids and the bar always showed empty. Switch to a sed extraction of 'Notification N:' lines from list+history. Verified against simulated input matching the user's real makoctl output: 0/some/all dismissed all render correctly. --- dot_config/waybar/executable_mako-status.sh | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'dot_config/waybar/executable_mako-status.sh') diff --git a/dot_config/waybar/executable_mako-status.sh b/dot_config/waybar/executable_mako-status.sh index a4fdd31..de9b215 100644 --- a/dot_config/waybar/executable_mako-status.sh +++ b/dot_config/waybar/executable_mako-status.sh @@ -1,7 +1,7 @@ #!/bin/sh # Waybar status: count of *pending* notifications, where pending = ids in -# mako's history that have NOT been explicitly dismissed by the user via -# Mod+n / Mod+Shift+n / the history picker. +# mako's history/list that have NOT been explicitly dismissed by the user +# via Mod+n / Mod+Shift+n / the history picker. # # State file: $XDG_RUNTIME_DIR/mako-dismissed (per-session, plain id list). @@ -16,13 +16,15 @@ fi state=${XDG_RUNTIME_DIR:-/tmp}/mako-dismissed : >>"$state" -# Visible notifications also count as pending (they aren't in history yet). -visible_ids=$(makoctl list -f '%i' 2>/dev/null || true) -history_ids=$(makoctl history -f '%i' 2>/dev/null || true) -all_ids=$(printf '%s -%s -' "$visible_ids" "$history_ids" \ - | grep -E '^[0-9]+$' | sort -u || true) +# This makoctl has no -f flag; parse the text dump. Each notification +# starts with "Notification N: ". Visible bubbles live in +# `list`, closed ones in `history`; their id-spaces are disjoint. +extract_ids() { + makoctl "$1" 2>/dev/null \ + | sed -n 's/^Notification \([0-9][0-9]*\):.*/\1/p' +} + +all_ids=$( { extract_ids list; extract_ids history; } | sort -un) # Prune stale ids (no longer present in mako) from the dismissed file. if [ -s "$state" ] && [ -n "$all_ids" ]; then -- cgit v1.3.1