From 25aa4347b3a85c66d445e09f864b7fe6c140a0f9 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 16 May 2022 06:19:11 -0700 Subject: [PATCH] fix(core): prepare window icon and menu on remote URLs, closes #4131 (#4140) --- .changes/fix-window-remote-url.md | 5 +++++ core/tauri/src/manager.rs | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 .changes/fix-window-remote-url.md diff --git a/.changes/fix-window-remote-url.md b/.changes/fix-window-remote-url.md new file mode 100644 index 000000000..6ade5e1c2 --- /dev/null +++ b/.changes/fix-window-remote-url.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Prepare window icon and menu even when loading remote URLs. Previously it was behind a `is local URL?` condition. diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index b8772d7e4..2e564fb14 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -458,20 +458,6 @@ impl WindowManager { pending.webview_attributes = webview_attributes; - if !pending.window_builder.has_icon() { - if let Some(default_window_icon) = self.inner.default_window_icon.clone() { - pending.window_builder = pending - .window_builder - .icon(default_window_icon.try_into()?)?; - } - } - - if pending.window_builder.get_menu().is_none() { - if let Some(menu) = &self.inner.menu { - pending = pending.set_menu(menu.clone()); - } - } - let mut registered_scheme_protocols = Vec::new(); for (uri_scheme, protocol) in &self.inner.uri_scheme_protocols { @@ -1118,6 +1104,20 @@ impl WindowManager { pending.url = url.to_string(); + if !pending.window_builder.has_icon() { + if let Some(default_window_icon) = self.inner.default_window_icon.clone() { + pending.window_builder = pending + .window_builder + .icon(default_window_icon.try_into()?)?; + } + } + + if pending.window_builder.get_menu().is_none() { + if let Some(menu) = &self.inner.menu { + pending = pending.set_menu(menu.clone()); + } + } + if is_local { let label = pending.label.clone(); pending = self.prepare_pending_window(