diff options
| author | Igor Soarez <igor@soarez.org> | 2026-10-27 14:12:28 +0200 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-10-27 14:12:28 +0200 |
| commit | 50c433e82c368b9861a89deecb74e5f29fa50353 (patch) | |
| tree | fe6d87b79387f6c53ef9bf615b7b530daf9a8d3a /menubar/main.swift | |
| parent | 9f3a567d4bb1b7b6e42a744936f993bcd437882d (diff) | |
mark as unread: make an idle agent done again, to come back to it
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).
Diffstat (limited to 'menubar/main.swift')
| -rw-r--r-- | menubar/main.swift | 12 |
1 files changed, 11 insertions, 1 deletions
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) { |
