diff --git a/README.md b/README.md
index a1f91c0..8abcfab 100644
--- a/README.md
+++ b/README.md
@@ -71,11 +71,12 @@ It comes in two styles, chosen in **Settings… → Menu Bar**:
Click the date and time to open Notification Center, choose **Edit Widgets**, and add **Agent Watch**.
-The small widget opens **Projects & Recent**. The medium widget also has **Waiting for you**, which
-opens the same list of waiting chats as the beacon, and **Settings**. Both work when the menu bar icon is hidden.
+The small widget opens **Projects & Recent**. The medium widget also has shortcuts to
+**Waiting for you** in that window and to **Settings**. Both widgets work when the menu bar icon is hidden.
An optional orange beacon appears when a chat is waiting for your reply. Choose **Full screen only** or **All modes** to show it on windowed desktops too.
-Click the ring and choose a chat to open it. Right-click it to open **Waiting Beacon Settings…**.
+Click the ring to open **Projects & Recent** on **Waiting for you**, then choose a chat.
+Right-click the ring to open **Waiting Beacon Settings…**.
You can also open **Settings → Waiting Beacon** to turn it on, resize it, or choose its position.
diff --git a/Sources/AgentWatchApp/AppDelegate.swift b/Sources/AgentWatchApp/AppDelegate.swift
index bfa4413..0a99415 100644
--- a/Sources/AgentWatchApp/AppDelegate.swift
+++ b/Sources/AgentWatchApp/AppDelegate.swift
@@ -168,9 +168,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
self?.supervisor.focusSession(id: id, requireDesktopLink: true) ?? .nothingRaised
},
resetBeacon: { [weak self] id in self?.supervisor.resetCodexQuestionBeacon(forSessionWithID: id) })
- private lazy var waitingWindow = WaitingChatsWindow(model: waitingChats)
private lazy var fullScreenDot = FullScreenDot(
- openWaiting: { [weak self] in self?.waitingWindow.present() },
+ openWaiting: { [weak self] screen in self?.navigate(to: .waiting, on: screen) },
openSettings: { [weak self] in
self?.settingsWindow.model.go(.waitingBeacon)
self?.showWidgetSettings()
@@ -771,32 +770,27 @@ extension AppDelegate: StatusMenuHost, SettingsHost {
return false
}
- private func navigate(to destination: WatchDestination) {
+ private func navigate(to destination: WatchDestination, on screen: NSScreen? = nil) {
switch destination {
case .projects: showProjects()
- // The widget's link opens the same list as the beacon: one list of waiting chats.
- case .waiting: waitingWindow.present()
+ case .waiting: presentProjects(.waiting, on: screen)
case .settings: showWidgetSettings()
}
}
func showProjects() { presentProjects(.recent) }
- private func presentProjects(_ scope: ProjectBrowserScope) {
+ private func presentProjects(_ scope: ProjectBrowserScope, on screen: NSScreen? = nil) {
if projectsWindow == nil {
projectsWindow = ProjectBrowserWindow(
- openSession: { [weak self] id in self?.focusSession(id: id) ?? .nothingRaised },
+ waitingChats: waitingChats,
settings: { [weak self] in self?.showWidgetSettings() }
) { [weak self] in
guard let self else { return }
updateProjects(supervisor.sessions, refresh: true)
}
}
- projectsWindow?.model.navigate(to: scope)
- let wasKey = projectsWindow?.window?.isKeyWindow == true
- projectsWindow?.showWindow(nil)
- NSApplication.shared.activate(ignoringOtherApps: true)
- if wasKey { updateProjects(supervisor.sessions, refresh: true) }
+ projectsWindow?.present(scope, on: screen)
}
private func updateProjects(_ sessions: [SessionSnapshot], refresh: Bool = false) {
diff --git a/Sources/AgentWatchApp/FullScreenDot.swift b/Sources/AgentWatchApp/FullScreenDot.swift
index 0b5a3f2..c1bb315 100644
--- a/Sources/AgentWatchApp/FullScreenDot.swift
+++ b/Sources/AgentWatchApp/FullScreenDot.swift
@@ -3,13 +3,13 @@ import AppKit
@MainActor
final class FullScreenDot: NSObject {
private var panels: [WaitingBeaconPanel] = []
- private let openWaiting: () -> Void
+ private let openWaiting: (NSScreen?) -> Void
private let openSettings: () -> Void
private var waitingCount = 0
private var isEnabled = false
private var scope = WaitingBeaconScope.fullScreenOnly
- init(openWaiting: @escaping () -> Void, openSettings: @escaping () -> Void) {
+ init(openWaiting: @escaping (NSScreen?) -> Void, openSettings: @escaping () -> Void) {
self.openWaiting = openWaiting
self.openSettings = openSettings
super.init()
@@ -134,7 +134,7 @@ final class FullScreenDot: NSObject {
private final class WaitingBeaconPanel: NSPanel {
let button: WaitingBeaconButton
- init(openWaiting: @escaping () -> Void, openSettings: @escaping () -> Void) {
+ init(openWaiting: @escaping (NSScreen?) -> Void, openSettings: @escaping () -> Void) {
button = WaitingBeaconButton(openSettings: openSettings, openWaiting: openWaiting)
super.init(
contentRect: button.bounds, styleMask: [.borderless, .nonactivatingPanel],
@@ -171,9 +171,9 @@ final class WaitingBeaconButton: NSButton {
private let light = CALayer()
private(set) var diameter: CGFloat = WidgetTheme.Timing.Dot().ringDiameter
private let openSettings: () -> Void
- private let openWaiting: () -> Void
+ private let openWaiting: (NSScreen?) -> Void
- init(openSettings: @escaping () -> Void = {}, openWaiting: @escaping () -> Void) {
+ init(openSettings: @escaping () -> Void = {}, openWaiting: @escaping (NSScreen?) -> Void) {
self.openSettings = openSettings
self.openWaiting = openWaiting
super.init(frame: NSRect(x: 0, y: 0, width: Self.side, height: Self.side))
@@ -213,7 +213,7 @@ final class WaitingBeaconButton: NSButton {
@objc private func configure() { openSettings() }
- @objc private func openList() { openWaiting() }
+ @objc private func openList() { openWaiting(window?.screen) }
func showCount(_ count: Int) {
title = count > 99 ? "99+" : String(count)
diff --git a/Sources/AgentWatchApp/ProjectBrowser.swift b/Sources/AgentWatchApp/ProjectBrowser.swift
index 742b412..8b57209 100644
--- a/Sources/AgentWatchApp/ProjectBrowser.swift
+++ b/Sources/AgentWatchApp/ProjectBrowser.swift
@@ -27,7 +27,7 @@ enum ProjectBrowserFilter: String, CaseIterable {
}
enum ProjectBrowserScope: Hashable {
- case recent, project(URL), unknown, profiles
+ case recent, waiting, project(URL), unknown, profiles
}
enum WatchDestination: String, CaseIterable {
@@ -208,10 +208,9 @@ final class ProjectBrowserModel: ObservableObject {
@MainActor
final class ProjectBrowserWindow: NSWindowController, NSWindowDelegate {
let model = ProjectBrowserModel()
- let refresh: () -> Void
+ private let refresh: () -> Void
- init(openSession: @escaping (String) -> SessionClick, settings: @escaping () -> Void, refresh: @escaping () -> Void)
- {
+ init(waitingChats: WaitingChatsModel, settings: @escaping () -> Void, refresh: @escaping () -> Void) {
self.refresh = refresh
let window = NSWindow(
contentRect: NSRect(x: 0, y: 0, width: 840, height: 540),
@@ -222,22 +221,56 @@ final class ProjectBrowserWindow: NSWindowController, NSWindowDelegate {
window.center()
super.init(window: window)
window.contentView = NSHostingView(
- rootView: ProjectBrowserView(model: model, refresh: refresh, openSession: openSession, settings: settings))
+ rootView: ProjectBrowserView(model: model, waitingChats: waitingChats, refresh: refresh, settings: settings)
+ )
window.delegate = self
}
@available(*, unavailable)
required init?(coder: NSCoder) { nil }
+ func present(_ scope: ProjectBrowserScope, on preferredScreen: NSScreen?) {
+ guard let window else { return }
+ model.navigate(to: scope)
+ let wasKey = window.isKeyWindow
+ let showsWaiting = scope == .waiting
+ let targetScreen =
+ showsWaiting
+ ? preferredScreen ?? NSScreen.screens.first { $0.frame.contains(NSEvent.mouseLocation) }
+ : nil
+
+ // Waiting can open from another app's full-screen Space, including Split View.
+ window.collectionBehavior =
+ showsWaiting
+ ? [.moveToActiveSpace, .canJoinAllApplications, .fullScreenAuxiliary]
+ : [.moveToActiveSpace]
+ window.level = showsWaiting ? .floating : .normal
+ if let screen = targetScreen, !window.isVisible || !window.isOnActiveSpace || window.screen != screen {
+ let area = screen.visibleFrame
+ window.setFrameOrigin(
+ NSPoint(x: area.midX - window.frame.width / 2, y: area.midY - window.frame.height / 2))
+ }
+ if window.isMiniaturized { window.deminiaturize(nil) }
+ showWindow(nil)
+ NSApp.activate(ignoringOtherApps: true)
+ if wasKey { refresh() }
+ }
+
func windowDidBecomeKey(_ notification: Notification) { refresh() }
+ func windowDidResignKey(_ notification: Notification) {
+ guard let window, window.level == .floating else { return }
+ window.level = .normal
+ window.collectionBehavior = [.moveToActiveSpace]
+ }
+
func windowWillClose(_ notification: Notification) { model.stop() }
}
private struct ProjectBrowserView: View {
@ObservedObject var model: ProjectBrowserModel
+ let waitingChats: WaitingChatsModel
let refresh: () -> Void
- let openSession: (String) -> SessionClick
let settings: () -> Void
private var projects: [GitWorkingCopy] {
@@ -250,6 +283,8 @@ private struct ProjectBrowserView: View {
NavigationSplitView {
List(selection: $model.scope) {
Label("Recent", systemImage: "clock").tag(ProjectBrowserScope.recent)
+ Label("Waiting for you", systemImage: "bubble.left.and.exclamationmark.bubble.right")
+ .tag(ProjectBrowserScope.waiting)
Label("Usage profiles", systemImage: "chart.bar").tag(ProjectBrowserScope.profiles)
Section("Projects") {
ForEach(projects, id: \.commonDirectory) { copy in
@@ -267,7 +302,9 @@ private struct ProjectBrowserView: View {
}
.navigationSplitViewColumnWidth(min: 150, ideal: 205)
} detail: {
- if model.scope == .profiles, let folders = model.folders {
+ if model.scope == .waiting {
+ WaitingChatsView(model: waitingChats)
+ } else if model.scope == .profiles, let folders = model.folders {
UsageProfilesView(
folders: folders, defaultClaudeUsage: model.claudeUsage, sessions: model.profileSessions,
readsTranscripts: model.readsTranscripts)
diff --git a/Sources/AgentWatchApp/WaitingChatsWindow.swift b/Sources/AgentWatchApp/WaitingChats.swift
similarity index 65%
rename from Sources/AgentWatchApp/WaitingChatsWindow.swift
rename to Sources/AgentWatchApp/WaitingChats.swift
index 5dc4bd2..cd281a0 100644
--- a/Sources/AgentWatchApp/WaitingChatsWindow.swift
+++ b/Sources/AgentWatchApp/WaitingChats.swift
@@ -1,5 +1,4 @@
import AgentWatchCore
-import AppKit
import SwiftUI
@MainActor
@@ -40,11 +39,9 @@ final class WaitingChatsModel: ObservableObject {
if let unavailableID, !waiting.contains(where: { $0.id == unavailableID }) { self.unavailableID = nil }
}
- func open(_ id: String) -> Bool {
- guard rows.contains(where: { $0.id == id }) else { return false }
- let opened = focus(id) == .raised
- unavailableID = opened ? nil : id
- return opened
+ func open(_ id: String) {
+ guard rows.contains(where: { $0.id == id }) else { return }
+ unavailableID = focus(id) == .raised ? nil : id
}
func resetBeacon(for id: String) {
@@ -53,44 +50,8 @@ final class WaitingChatsModel: ObservableObject {
}
}
-@MainActor
-final class WaitingChatsWindow: NSWindowController {
- init(model: WaitingChatsModel) {
- let panel = NSPanel(
- contentRect: NSRect(x: 0, y: 0, width: 380, height: 280),
- styleMask: [.titled, .closable, .resizable], backing: .buffered, defer: false)
- panel.title = "Chats waiting for your reply"
- panel.isReleasedWhenClosed = false
- panel.contentMinSize = NSSize(width: 280, height: 120)
- panel.collectionBehavior = [.moveToActiveSpace, .canJoinAllApplications, .fullScreenAuxiliary]
- panel.level = .floating
- super.init(window: panel)
- panel.contentView = NSHostingView(
- rootView: WaitingChatsView(model: model) { [weak panel] id in
- if model.open(id) { panel?.orderOut(nil) }
- })
- }
-
- @available(*, unavailable)
- required init?(coder: NSCoder) { fatalError() }
-
- func present() {
- guard let window else { return }
- if let screen = NSScreen.screens.first(where: { $0.frame.contains(NSEvent.mouseLocation) }),
- !window.isVisible || window.screen != screen
- {
- let area = screen.visibleFrame
- window.setFrameOrigin(
- NSPoint(x: area.midX - window.frame.width / 2, y: area.midY - window.frame.height / 2))
- }
- NSApp.activate(ignoringOtherApps: true)
- window.makeKeyAndOrderFront(nil)
- }
-}
-
-private struct WaitingChatsView: View {
+struct WaitingChatsView: View {
@ObservedObject var model: WaitingChatsModel
- let open: (String) -> Void
var body: some View {
if model.rows.isEmpty {
@@ -100,7 +61,7 @@ private struct WaitingChatsView: View {
} else {
List(model.rows) { row in
Button {
- open(row.id)
+ model.open(row.id)
} label: {
HStack {
VStack(alignment: .leading, spacing: 3) {
diff --git a/Tests/AgentWatchAppTests/DocumentationRenderProbe.swift b/Tests/AgentWatchAppTests/DocumentationRenderProbe.swift
index 4332680..1138db5 100644
--- a/Tests/AgentWatchAppTests/DocumentationRenderProbe.swift
+++ b/Tests/AgentWatchAppTests/DocumentationRenderProbe.swift
@@ -79,7 +79,7 @@ final class DocumentationRenderProbe: XCTestCase {
func testDrawTheWaitingBeacon() throws {
let root = try outputDirectory()
- let beacon = WaitingBeaconButton {}
+ let beacon = WaitingBeaconButton { _ in }
beacon.showCount(2)
try write(framed(beacon, padding: 6, color: .clear), "full-screen-beacon", in: root)
}
diff --git a/Tests/AgentWatchAppTests/FullScreenDotTests.swift b/Tests/AgentWatchAppTests/FullScreenDotTests.swift
index b3f8845..99fdc19 100644
--- a/Tests/AgentWatchAppTests/FullScreenDotTests.swift
+++ b/Tests/AgentWatchAppTests/FullScreenDotTests.swift
@@ -41,7 +41,7 @@ final class FullScreenDotTests: XCTestCase {
func testBeaconIsAnActionWithAnAccessibleExactCountEvenWhenTheNumberIsAbbreviated() {
var opened = 0
- let beacon = WaitingBeaconButton { opened += 1 }
+ let beacon = WaitingBeaconButton { _ in opened += 1 }
beacon.showCount(126)
XCTAssertEqual(beacon.title, "99+")
XCTAssertEqual(beacon.accessibilityLabel(), "126 chats waiting for a reply")
@@ -52,7 +52,7 @@ final class FullScreenDotTests: XCTestCase {
func testBeaconSizeKeepsTheClickTargetAndItsContextMenuOpensSettings() throws {
var settingsOpened = false
var chatsOpened = false
- let beacon = WaitingBeaconButton(openSettings: { settingsOpened = true }) { chatsOpened = true }
+ let beacon = WaitingBeaconButton(openSettings: { settingsOpened = true }) { _ in chatsOpened = true }
XCTAssertEqual(beacon.diameter, 24)
beacon.setDiameter(30)
XCTAssertEqual(beacon.diameter, 30)
@@ -65,7 +65,7 @@ final class FullScreenDotTests: XCTestCase {
}
func testReduceMotionStopsTheOrbitAndKeepsTheCount() {
- let beacon = WaitingBeaconButton {}
+ let beacon = WaitingBeaconButton { _ in }
beacon.showCount(3)
beacon.setRotating(true)
XCTAssertTrue(beacon.isRotating)
diff --git a/Tests/AgentWatchAppTests/ProjectBrowserTests.swift b/Tests/AgentWatchAppTests/ProjectBrowserTests.swift
index b09954d..22b8b0b 100644
--- a/Tests/AgentWatchAppTests/ProjectBrowserTests.swift
+++ b/Tests/AgentWatchAppTests/ProjectBrowserTests.swift
@@ -33,10 +33,15 @@ final class ProjectBrowserTests: XCTestCase {
model.scope = .profiles
model.search = "an old search"
model.filter = .quiet
- model.navigate(to: .recent)
- XCTAssertEqual(model.scope, .recent)
+ model.message = "An old opening error"
+ model.navigate(to: .waiting)
+ XCTAssertEqual(model.scope, .waiting)
XCTAssertTrue(model.search.isEmpty)
XCTAssertEqual(model.filter, .all)
+ XCTAssertNil(model.message)
+
+ model.navigate(to: .recent)
+ XCTAssertEqual(model.scope, .recent)
}
/// A new chat appearing while a click is being resolved rereads the list; the click still
diff --git a/Tests/AgentWatchAppTests/WaitingChatsTests.swift b/Tests/AgentWatchAppTests/WaitingChatsTests.swift
index 2cdd001..132184b 100644
--- a/Tests/AgentWatchAppTests/WaitingChatsTests.swift
+++ b/Tests/AgentWatchAppTests/WaitingChatsTests.swift
@@ -24,11 +24,11 @@ final class WaitingChatsTests: XCTestCase {
model.update([first, headless, second])
XCTAssertEqual(model.rows.map(\.id), [second.id, first.id])
- XCTAssertTrue(model.open(first.id))
+ model.open(first.id)
model.update([third, second])
XCTAssertEqual(model.rows.map(\.id), [third.id, second.id])
- XCTAssertFalse(model.open(first.id))
- XCTAssertTrue(model.open(second.id))
+ model.open(first.id)
+ model.open(second.id)
XCTAssertEqual(focused, [first.id, second.id])
model.update([])
XCTAssertTrue(model.rows.isEmpty)
@@ -90,10 +90,10 @@ final class WaitingChatsTests: XCTestCase {
var result = SessionClick.nothingRaised
let model = WaitingChatsModel(focus: { _ in result }, resetBeacon: { _ in })
model.update([session])
- XCTAssertFalse(model.open(session.id))
+ model.open(session.id)
XCTAssertEqual(model.unavailableID, session.id)
result = .raised
- XCTAssertTrue(model.open(session.id))
+ model.open(session.id)
XCTAssertNil(model.unavailableID)
}
}
diff --git a/docs/menu-bar.md b/docs/menu-bar.md
index 62f6137..c5b443b 100644
--- a/docs/menu-bar.md
+++ b/docs/menu-bar.md
@@ -79,9 +79,10 @@
В `Settings → Waiting Beacon` включите `Show waiting beacon`. В поле `Show in` выберите
`Full screen only` для полноэкранных рабочих столов или `All modes` для всех подключённых экранов,
включая рабочие столы с обычными окнами. Под строкой меню
-появляется оранжевое кольцо с числом чатов, которые ждут ответа. Щелчок открывает их список. Выберите чат в списке, чтобы вернуться к вопросу. Для настольных
-Claude и Codex список закрывается после передачи ссылки на выбранный чат. Если ссылку получить
-или открыть не удалось, строка предлагает открыть чат в приложении или повторить попытку.
+появляется оранжевое кольцо с числом чатов, которые ждут ответа. Щелчок выводит окно
+`Projects & Recent` на передний план и выбирает раздел `Waiting for you`. Выберите чат, чтобы
+вернуться к вопросу. Если открыть чат не удалось, строка предлагает открыть его в приложении
+или повторить попытку.
Чтобы убрать сигнал об уже показанных асинхронных вопросах Codex, нажмите правой кнопкой на чат
в списке и выберите `Reset Beacon`. Обычное текстовое сообщение в том же чате тоже сбрасывает
@@ -121,6 +122,8 @@ Claude и Codex список закрывается после передачи
### Проекты и недавние чаты
Пункт `Projects & Recent…` открывает окно с наблюдаемыми чатами настольных Claude и Codex.
+Раздел `Waiting for you` показывает те же ожидающие чаты, которые считает маячок, включая
+сессии в терминале.
То же окно открывается, когда уже запущенный Agent Watch открывают снова из Finder или Spotlight:
так до него можно добраться и со скрытым значком в строке меню.
В разделе `Recent` видно до 20 чатов. Сначала идут текущие, затем чаты с завершённым ходом,
diff --git a/docs/settings.md b/docs/settings.md
index 21ce7b4..9fa99ce 100644
--- a/docs/settings.md
+++ b/docs/settings.md
@@ -151,8 +151,8 @@
Нажатие на дату и время открывает Центр уведомлений macOS. Через «Изменить виджеты» можно
добавить Agent Watch. Малый виджет открывает проекты и недавние чаты. В среднем есть также
-кнопка `Waiting for you`, которая открывает тот же список ожидающих чатов, что и маячок, и переход
-к настройкам.
+кнопка `Waiting for you`, которая, как и маячок, выбирает раздел ожидающих чатов в окне
+`Projects & Recent`, и переход к настройкам.
Как это вообще работает, когда приложение никогда не активно, и почему выбран Carbon —
[ADR-0009](adr/0009-the-global-shortcut-goes-through-carbon.md).