aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:33 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:33 +0100
commitd1891aad42ea4f633e7a731c2f140e592c3d9244 (patch)
tree27c4bf6d39c972adf15d60037cc8f523b6464c4e
parent5b6bfa3904a2013dbcd798488baf4661332880d0 (diff)
downloaddotfiles-d1891aad42ea4f633e7a731c2f140e592c3d9244.tar.gz
dotfiles-d1891aad42ea4f633e7a731c2f140e592c3d9244.tar.bz2
dotfiles-d1891aad42ea4f633e7a731c2f140e592c3d9244.zip
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.
-rw-r--r--dot_config/waybar/executable_mako-history.py47
1 files changed, 25 insertions, 22 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)
+ while True:
+ dismissed = load_dismissed()
+ notifs = parse_history(dismissed)
- if not notifs:
- _ = run_wofi("(no notifications)\n", 1)
- return
+ 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
+ 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
+ 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)
+ 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__":