Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion crates/agent_ui/src/agent_panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,17 @@ pub fn init(cx: &mut App) {
});
});
},
);
)
.register_action(|workspace, _: &menu::Cancel, _window, cx| {
if let Some(panel) = workspace.panel::<AgentPanel>(cx) {
let dismissed =
panel.update(cx, |panel, cx| panel.dismiss_all_notifications(cx));
if dismissed {
return;
}
}
cx.propagate();
});
},
)
.detach();
Expand Down Expand Up @@ -2774,6 +2784,22 @@ impl AgentPanel {
}
}

pub fn dismiss_all_notifications(&mut self, cx: &mut Context<Self>) -> bool {
let mut dismissed = false;
for conversation_view in self.conversation_views() {
dismissed |= conversation_view.update(cx, |view, cx| view.dismiss_notifications(cx));
}
let had_terminal_notifications = self
.terminals
.values()
.any(|t| !t.notification_windows.is_empty());
if had_terminal_notifications {
self.dismiss_all_terminal_notifications(cx);
dismissed = true;
}
dismissed
}

fn active_terminal_visible(&self, terminal_id: TerminalId, window: &Window, cx: &App) -> bool {
if !window.is_window_active() {
return false;
Expand Down
4 changes: 3 additions & 1 deletion crates/agent_ui/src/conversation_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2668,7 +2668,8 @@ impl ConversationView {
}
}

fn dismiss_notifications(&mut self, cx: &mut Context<Self>) {
pub(crate) fn dismiss_notifications(&mut self, cx: &mut Context<Self>) -> bool {
let had_notifications = !self.notifications.is_empty();
for window in self.notifications.drain(..) {
window
.update(cx, |_, window, _| {
Expand All @@ -2678,6 +2679,7 @@ impl ConversationView {

self.notification_subscriptions.remove(&window);
}
had_notifications
}

fn agent_ui_font_size_changed(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
Expand Down
Loading