From 9211888b03b78a0404c74594780a33daad99d7d3 Mon Sep 17 00:00:00 2001 From: nozwock <57829219+nozwock@users.noreply.github.com> Date: Mon, 15 Jul 2024 00:42:41 +0530 Subject: [PATCH 1/2] Replace hardcoded version with dynamic value in title name --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ccfa347..5584c6d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -41,7 +41,7 @@ fn main() -> Result<(), eframe::Error> { ..Default::default() }; - eframe::run_native("ER Save Editor 0.0.21", options, Box::new(|creation_context| { + eframe::run_native(&format!("ER Save Editor {}", env!("CARGO_PKG_VERSION")), options, Box::new(|creation_context| { let mut fonts = egui::FontDefinitions::default(); egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Regular); egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Fill); From 293d6ae2995b7712ee2e53cc07ed9831dd4417b3 Mon Sep 17 00:00:00 2001 From: nozwock <57829219+nozwock@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:29:42 +0530 Subject: [PATCH 2/2] Set window title properly using ViewportBuilder As `app_name` in `run_native()` is not just the title name but is also used for other purposes, for eg. the name of the persistence data directory. --- src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5584c6d..082cff8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -36,12 +36,14 @@ fn main() -> Result<(), eframe::Error> { app_icon.height = icon_height; let options = eframe::NativeOptions { - viewport: egui::ViewportBuilder::default().with_inner_size([WINDOW_WIDTH, WINDOW_HEIGHT]) - .with_icon(app_icon), + viewport: egui::ViewportBuilder::default() + .with_title(format!("ER Save Editor {}", env!("CARGO_PKG_VERSION"))) + .with_inner_size([WINDOW_WIDTH, WINDOW_HEIGHT]) + .with_icon(app_icon), ..Default::default() }; - eframe::run_native(&format!("ER Save Editor {}", env!("CARGO_PKG_VERSION")), options, Box::new(|creation_context| { + eframe::run_native("ER Save Editor", options, Box::new(|creation_context| { let mut fonts = egui::FontDefinitions::default(); egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Regular); egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Fill);