From d1891aad42ea4f633e7a731c2f140e592c3d9244 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:33 +0100 Subject: feat(mako-history): reopen picker after each selection After Enter copies+dismisses an entry, reopen the wofi window so the remaining notifications can be processed without re-triggering the keybind. Esc closes the loop. --- dot_config/waybar/executable_mako-history.py | 55 +++++++++++++++------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/dot_config/waybar/executable_mako-history.py b/dot_config/waybar/executable_mako-history.py index d98e4b5..a8104f7 100644 --- a/dot_config/waybar/executable_mako-history.py +++ b/dot_config/waybar/executable_mako-history.py @@ -3,10 +3,12 @@ Lists pending mako notifications (visible bubbles + history). Entries dismissed via this picker are hidden so the list shrinks as you process it. +The picker re-opens after each selection so multiple notifications can be +processed in one go; Esc closes it. Keys: - Enter copy "summary\\nbody" to the clipboard and dismiss the entry - Esc cancel + Enter copy "summary\\nbody" to the clipboard, dismiss the entry, reopen + Esc close the picker State file: $XDG_RUNTIME_DIR/mako-dismissed (one id per line, per-session). """ @@ -142,30 +144,31 @@ def run_wofi(input_text: str, lines: int) -> str: def main() -> None: - dismissed = load_dismissed() - notifs = parse_history(dismissed) - - if not notifs: - _ = run_wofi("(no notifications)\n", 1) - return - - lines_text = "\n".join(fmt_line(n) for n in notifs) + "\n" - sel = run_wofi(lines_text, min(len(notifs), 15)) - if not sel or sel.startswith("(no "): - return - - nid = parse_selection(sel) - if nid is None: - return - notif = next((n for n in notifs if n["id"] == nid), None) - if notif is None: - return - - summary = str(notif.get("summary") or "").strip() - body = str(notif.get("body") or "").strip() - clip_text = f"{summary}\n{body}".strip() - _ = subprocess.run(["wl-copy"], input=clip_text, text=True, check=False) - add_dismissed(nid) + while True: + dismissed = load_dismissed() + notifs = parse_history(dismissed) + + if not notifs: + _ = run_wofi("(no notifications)\n", 1) + return + + lines_text = "\n".join(fmt_line(n) for n in notifs) + "\n" + sel = run_wofi(lines_text, min(len(notifs), 15)) + if not sel or sel.startswith("(no "): + return + + nid = parse_selection(sel) + if nid is None: + return + notif = next((n for n in notifs if n["id"] == nid), None) + if notif is None: + return + + summary = str(notif.get("summary") or "").strip() + body = str(notif.get("body") or "").strip() + clip_text = f"{summary}\n{body}".strip() + _ = subprocess.run(["wl-copy"], input=clip_text, text=True, check=False) + add_dismissed(nid) if __name__ == "__main__": -- cgit v1.3.1