Skip to content

Commit

Permalink
Only set title bar style on support platforms (macos)
Browse files Browse the repository at this point in the history
  • Loading branch information
phildenhoff committed Oct 11, 2024
1 parent 958aae7 commit 792fd37
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit 792fd37

Please sign in to comment.