aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:29 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:29 +0100
commitce97dd5d68dfca687db0bdcd5adb6add6ed45e50 (patch)
tree4acba52a3b6ef8df0d96849e57080c508fd015ca
parent5b8b959cd18e75b67f7b3cd0ea2b8b24b1f41952 (diff)
downloaddotfiles-ce97dd5d68dfca687db0bdcd5adb6add6ed45e50.tar.gz
dotfiles-ce97dd5d68dfca687db0bdcd5adb6add6ed45e50.tar.bz2
dotfiles-ce97dd5d68dfca687db0bdcd5adb6add6ed45e50.zip
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.
-rw-r--r--dot_config/waybar/executable_mako-status.sh20
1 files changed, 11 insertions, 9 deletions
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: <summary>". 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