瀏覽代碼

use the name in the dioxus.toml in desktop if no name was set in the desktop config

Evan Almloff 1 年之前
父節點
當前提交
15984b78db
共有 2 個文件被更改,包括 7 次插入1 次删除
  1. 1 0
      packages/desktop/Cargo.toml
  2. 6 1
      packages/desktop/src/cfg.rs

+ 1 - 0
packages/desktop/Cargo.toml

@@ -14,6 +14,7 @@ dioxus-core = { workspace = true, features = ["serialize"] }
 dioxus-html = { workspace = true, features = ["serialize", "native-bind"] }
 dioxus-interpreter-js = { workspace = true }
 dioxus-hot-reload = { workspace = true, optional = true }
+dioxus-cli-config = { workspace = true }
 
 serde = "1.0.136"
 serde_json = "1.0.79"

+ 6 - 1
packages/desktop/src/cfg.rs

@@ -49,7 +49,12 @@ impl Config {
     /// Initializes a new `WindowBuilder` with default values.
     #[inline]
     pub fn new() -> Self {
-        let window = WindowBuilder::new().with_title("Dioxus app");
+        let window = WindowBuilder::new().with_title(
+            dioxus_cli_config::CURRENT_CONFIG
+                .as_ref()
+                .map(|c| c.dioxus_config.application.name.clone())
+                .unwrap_or("Dioxus App".to_string()),
+        );
 
         Self {
             // event_handler: None,