Browse Source

fix(core): prepare window icon and menu on remote URLs, closes #4131 (#4140)

Lucas Fernandes Nogueira 3 years ago
parent
commit
25aa4347b3
2 changed files with 19 additions and 14 deletions
  1. 5 0
      .changes/fix-window-remote-url.md
  2. 14 14
      core/tauri/src/manager.rs

+ 5 - 0
.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.

+ 14 - 14
core/tauri/src/manager.rs

@@ -458,20 +458,6 @@ impl<R: Runtime> WindowManager<R> {
 
     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<R: Runtime> WindowManager<R> {
 
     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(