From 50c433e82c368b9861a89deecb74e5f29fa50353 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Tue, 27 Oct 2026 14:12:28 +0200 Subject: mark as unread: make an idle agent done again, to come back to it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit like "mark as unread" in mail: an agent you have seen (idle) becomes done again, last among done agents of its importance, with no sound or notification. it stays done until you come back to it: leave its tmux window and return, or jump to it. marked while you look at it, it holds until you look away (`held`); a new turn clears it. only idle agents can be marked. - daemon: `pane.mark_unread` on the hook socket; the watcher applies it after the tick's observations (mark_unread, advance's hold rule). - `dingger unread [--pane]`: refuses done, working, blocked, and panes without an agent; returns once the agent shows as done. - pi: /unread (refused while the agent works or is blocked). - panel: right-click an idle agent in the full list, "Mark as unread". - search: ⌘U or right-click marks the selected idle agent; the footer offers ⌘U when it applies; search stays open. tests: unit (hold, jump, new turn, idle only), e2e step 22 (queue position, hold, look away and back, jump, refusals, no sound, menu, the extension), pi-live in real pi 1.4 (a mark, not a turn: an unknown command would also end done), swift selftest (menu only for idle, footer). --- menubar/main.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'menubar/main.swift') diff --git a/menubar/main.swift b/menubar/main.swift index 1b6ce4f..135c099 100644 --- a/menubar/main.swift +++ b/menubar/main.swift @@ -88,10 +88,12 @@ final class Menubar: NSObject, NSApplicationDelegate, NSMenuDelegate { item.menu = menu panel = PanelController( onClick: { [weak self] paneId in self?.jump(to: paneId) }, + onMarkUnread: { [weak self] paneId in self?.markUnread(paneId) }, onToggleFull: { [weak self] in self?.toggleFull() }, onRestore: { [weak self] in self?.restore(sessions: []) }, onDismissRestore: { [weak self] in self?.dismissRestore() }) - searchWindow = SearchController(onJump: { [weak self] paneId in self?.jump(to: paneId) }) + searchWindow = SearchController(onJump: { [weak self] paneId in self?.jump(to: paneId) }, + onMarkUnread: { [weak self] paneId in self?.markUnread(paneId) }) Settings.ensureFile() reloadSettings() refresh() @@ -258,6 +260,14 @@ final class Menubar: NSObject, NSApplicationDelegate, NSMenuDelegate { } } + private func markUnread(_ paneId: String) { + log("unread: \(paneId)") + DispatchQueue.global().async { + markAgentUnread(paneId) + DispatchQueue.main.async { self.refresh() } + } + } + // MARK: menu (rebuilt from fresh data every time it opens) func menuNeedsUpdate(_ menu: NSMenu) { -- cgit v1.2.3