Feat: always_on_top CLI Setting (#2715)

* feat: always_on_top cli setting

* revision: add user message for configuring settings
This commit is contained in:
Miles Murgaw authored and GitHub committed 2024-07-26 16:27:56 -07:00
1 parent e42b71b1ba
commit 810f8bbfb8
5 files changed
+74 -13

No files matched your search

+15 -9
View File
@@ -49,15 +49,21 @@ impl Config {
/// Initializes a new `WindowBuilder` with default values.
#[inline]
pub fn new() -> Self {
let window: WindowBuilder = WindowBuilder::new()
.with_title(
dioxus_cli_config::CURRENT_CONFIG
.as_ref()
.map(|c| c.application.name.clone())
.unwrap_or("Dioxus App".to_string()),
)
// During development we want the window to be on top so we can see it while we work
.with_always_on_top(cfg!(debug_assertions));
let dioxus_config = dioxus_cli_config::CURRENT_CONFIG.as_ref();
let mut window: WindowBuilder = WindowBuilder::new().with_title(
dioxus_config
.map(|c| c.application.name.clone())
.unwrap_or("Dioxus App".to_string()),
);
// During development we want the window to be on top so we can see it while we work
let always_on_top = dioxus_config
.map(|c| c.desktop.always_on_top)
.unwrap_or(true);
if cfg!(debug_assertions) {
window = window.with_always_on_top(always_on_top);
}
Self {
window,