From 7aacc7566c6bae7b477441763a03e4f98f9e2271 Mon Sep 17 00:00:00 2001 From: Abdugani Toshmukhamedov <79999469+toshmukhamedov@users.noreply.github.com> Date: Mon, 10 Nov 2025 19:09:37 +0500 Subject: [PATCH] Add support for closing window tabs with middle mouse click (#41628) This change adds support for closing a system window tabs by pressing the middle mouse button. It improves tab management UX by matching common tab behavior. Release Notes: - Added support for closing system window tabs with middle mouse click. --- crates/title_bar/src/system_window_tabs.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/title_bar/src/system_window_tabs.rs b/crates/title_bar/src/system_window_tabs.rs index ba898da716f042573840f8f9c9f375747ac5cc04..a9bf46cc4f9f33586d1129dec1c64a67f1e42198 100644 --- a/crates/title_bar/src/system_window_tabs.rs +++ b/crates/title_bar/src/system_window_tabs.rs @@ -227,6 +227,15 @@ impl SystemWindowTabs { window.activate_window(); }); }) + .on_mouse_up(MouseButton::Middle, move |_, window, cx| { + if item.handle.window_id() == window.window_handle().window_id() { + window.dispatch_action(Box::new(CloseWindow), cx); + } else { + let _ = item.handle.update(cx, |_, window, cx| { + window.dispatch_action(Box::new(CloseWindow), cx); + }); + } + }) .child(label) .map(|this| match show_close_button { ShowCloseButton::Hidden => this,