From b0b90feadd64146d0544ed8da03f1385901f4ff6 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Fri, 27 Mar 2026 20:29:32 +0200 Subject: [PATCH] feat(cef): apply traffic light position on macOS after theme change (#15163) --- crates/tauri-runtime-cef/src/cef_impl.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/tauri-runtime-cef/src/cef_impl.rs b/crates/tauri-runtime-cef/src/cef_impl.rs index 1185c49e9..a7e5f77cd 100644 --- a/crates/tauri-runtime-cef/src/cef_impl.rs +++ b/crates/tauri-runtime-cef/src/cef_impl.rs @@ -1273,6 +1273,12 @@ wrap_window_delegate! { view.set_background_color(color); } + // Apply traffic light position after system theme changed + #[cfg(target_os = "macos")] + if let (Some(window), Some(position)) = (view.window(), attrs.traffic_light_position) { + apply_traffic_light_position(window.window_handle(), &position); + } + if std::mem::take(&mut *self.suppress_next_theme_changed.borrow_mut()) { return; } @@ -3095,11 +3101,6 @@ fn handle_window_message( { let window = app_window.window(); apply_macos_window_theme(window.as_ref(), theme); - - let traffic_light_position = app_window.attributes.borrow().traffic_light_position; - if let (Some(window), Some(position)) = (window, traffic_light_position) { - apply_traffic_light_position(window.window_handle(), &position); - } } // theme changed event is sent by the on_theme_changed handler }