Adds a way to dismiss workspace notifications (#30015)
Closes https://github.com/zed-industries/zed/issues/10140 * On `menu::Cancel` action (`ESC`), close notifications, one by one, if `Workspace` gets to handle this action. More specific, focused items contexts (e.g. `Editor`) take priority. * Allows to temporarily suppress notifications of this kind either by clicking a corresponding button in the UI, or using `workspace::SuppressNotification` action. This might not work well out of the box for all notifications and might require further improvement. https://github.com/user-attachments/assets/0ea49ee6-cd21-464f-ba74-fc40f7a8dedf Release Notes: - Added a way to dismiss workspace notifications
This commit is contained in:
parent
7d361ec97e
commit
007fd0586a
5 changed files with 96 additions and 13 deletions
|
@ -22,7 +22,9 @@ use ui::{
|
|||
Avatar, Button, Icon, IconButton, IconName, Label, Tab, Tooltip, h_flex, prelude::*, v_flex,
|
||||
};
|
||||
use util::{ResultExt, TryFutureExt};
|
||||
use workspace::notifications::{Notification as WorkspaceNotification, NotificationId};
|
||||
use workspace::notifications::{
|
||||
Notification as WorkspaceNotification, NotificationId, SuppressEvent,
|
||||
};
|
||||
use workspace::{
|
||||
Workspace,
|
||||
dock::{DockPosition, Panel, PanelEvent},
|
||||
|
@ -823,6 +825,11 @@ impl Render for NotificationToast {
|
|||
IconButton::new("close", IconName::Close)
|
||||
.on_click(cx.listener(|_, _, _, cx| cx.emit(DismissEvent))),
|
||||
)
|
||||
.child(
|
||||
IconButton::new("suppress", IconName::XCircle)
|
||||
.tooltip(Tooltip::text("Do not show until restart"))
|
||||
.on_click(cx.listener(|_, _, _, cx| cx.emit(SuppressEvent))),
|
||||
)
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
this.focus_notification_panel(window, cx);
|
||||
cx.emit(DismissEvent);
|
||||
|
@ -831,3 +838,4 @@ impl Render for NotificationToast {
|
|||
}
|
||||
|
||||
impl EventEmitter<DismissEvent> for NotificationToast {}
|
||||
impl EventEmitter<SuppressEvent> for NotificationToast {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue