Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

workspace: Close toasts on middle mouse click (#48208)

Lukas Wirthd5e58b9eb48c
diff --git a/crates/workspace/src/toast_layer.rs b/crates/workspace/src/toast_layer.rs
index ef1832e6f29..5979c376f65 100644
--- a/crates/workspace/src/toast_layer.rs
+++ b/crates/workspace/src/toast_layer.rs
@@ -3,7 +3,10 @@ use std::{
time::{Duration, Instant},
};
-use gpui::{AnyView, DismissEvent, Entity, EntityId, FocusHandle, ManagedView, Subscription, Task};
+use gpui::{
+ AnyView, DismissEvent, Entity, EntityId, FocusHandle, ManagedView, MouseButton, Subscription,
+ Task,
+};
use ui::{animation::DefaultAnimations, prelude::*};
use zed_actions::toast;
@@ -244,6 +247,12 @@ impl Render for ToastLayer {
.on_click(|_, _, cx| {
cx.stop_propagation();
})
+ .on_mouse_down(
+ MouseButton::Middle,
+ cx.listener(|this, _, _, cx| {
+ this.hide_toast(cx);
+ }),
+ )
.child(active_toast.toast.view()),
)
.animate_in(AnimationDirection::FromBottom, true),