From e29829826c224b8d8d043a88266e37239f52f708 Mon Sep 17 00:00:00 2001 From: Phil Denhoff Date: Thu, 10 Oct 2024 20:01:06 -0700 Subject: [PATCH] Only set title bar style on support platforms (macos) --- src-tauri/src/main.rs | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 90ba00f..df66de2 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -44,15 +44,23 @@ fn run_tauri_backend() -> std::io::Result<()> { tauri::Builder::default() .setup(|app| { - let main_window = - tauri::WindowBuilder::new(app, "main", tauri::WindowUrl::App("index.html".into())) - // Hide main app window until UI app is ready & makes visible - .visible(false) - // UI app controls custom window decorations - .title_bar_style(tauri::TitleBarStyle::Overlay) - .title("") - .build() - .expect("failed to create main window"); + let main_window = { + let mut builder = tauri::WindowBuilder::new( + app, + "main", + tauri::WindowUrl::App("index.html".into()), + ) + // Hide main app window until UI app is ready & makes visible + .visible(false) + .title(""); + + #[cfg(target_os = "macos")] + { + builder = builder.title_bar_style(tauri::TitleBarStyle::Overlay); + } + + builder.build().expect("failed to create main window") + }; main_window.center().unwrap(); Ok(())