From 0a5c53a1198e9645501ec17af06478e0efb3bcc3 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:29 +0100 Subject: fix(waybar): dismiss/restore wrappers parse mako text format Same -f-doesn't-exist regression as 3205afc / d76ff3c. Without -f the inner pipeline produced no ids, so the dismissed-set never grew and notifications stayed pending forever after Mod+n. Switch to sed extraction of 'Notification N:' lines for both dismiss-visible.sh (list) and restore-pending.sh (history). Verified the dismissed-set is populated correctly for top/all modes. --- dot_config/waybar/executable_dismiss-visible.sh | 10 ++++++++-- dot_config/waybar/executable_restore-pending.sh | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dot_config/waybar/executable_dismiss-visible.sh b/dot_config/waybar/executable_dismiss-visible.sh index 98d240b..32d4a8a 100644 --- a/dot_config/waybar/executable_dismiss-visible.sh +++ b/dot_config/waybar/executable_dismiss-visible.sh @@ -16,14 +16,20 @@ mkdir -p "$(dirname "$state")" command -v makoctl >/dev/null 2>&1 || exit 0 +# This makoctl has no -f; extract ids from the text dump. +list_ids() { + makoctl list 2>/dev/null \ + | sed -n 's/^Notification \([0-9][0-9]*\):.*/\1/p' +} + case "$mode" in top) - id=$(makoctl list -f '%i' 2>/dev/null | head -n1 || true) + id=$(list_ids | head -n1 || true) [ -n "${id:-}" ] && printf '%s\n' "$id" >>"$state" makoctl dismiss ;; all) - makoctl list -f '%i' 2>/dev/null >>"$state" || true + list_ids >>"$state" || true makoctl dismiss --all ;; *) diff --git a/dot_config/waybar/executable_restore-pending.sh b/dot_config/waybar/executable_restore-pending.sh index 53da3f4..028de0e 100644 --- a/dot_config/waybar/executable_restore-pending.sh +++ b/dot_config/waybar/executable_restore-pending.sh @@ -11,7 +11,9 @@ command -v makoctl >/dev/null 2>&1 || exit 0 # mako's history is most-recent-first; the next restore() target is the # top of the list at the time of the call. -top_id=$(makoctl history -f '%i' 2>/dev/null | head -n1 || true) +top_id=$(makoctl history 2>/dev/null \ + | sed -n 's/^Notification \([0-9][0-9]*\):.*/\1/p' \ + | head -n1 || true) makoctl restore || true if [ -n "${top_id:-}" ] && [ -s "$state" ]; then -- cgit v1.3.1