From dc46bbc1ef61325bc3d92814add957ae94ce7641 Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:48:17 +0700 Subject: [PATCH] hideTitleBar prop on `open_full_window` --- lib/window.ts | 4 +++- src-tauri/common/window.rs | 16 +++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/window.ts b/lib/window.ts index 8789ff3..c645545 100644 --- a/lib/window.ts +++ b/lib/window.ts @@ -5,12 +5,14 @@ import { platform } from '@tauri-apps/plugin-os' export async function openFullWindow({ name, url, + hideTitleBar = false, }: { name: string url: string + hideTitleBar?: boolean }) { console.log('[openFullWindow] ', name, url) - await invoke('open_full_window', { name, url }) + await invoke('open_full_window', { name, url, hideTitleBar }) return WebviewWindow.getByLabel(name) } diff --git a/src-tauri/common/window.rs b/src-tauri/common/window.rs index 40f8969..97f2a85 100644 --- a/src-tauri/common/window.rs +++ b/src-tauri/common/window.rs @@ -30,10 +30,12 @@ pub fn make_transparent(_window: &WebviewWindow) -> Result<(), tauri::Error> { } #[tauri::command] +#[allow(unused_variables)] pub async fn open_full_window( app_handle: AppHandle, name: String, url: String, + hide_title_bar: Option, ) -> Result<(), String> { if let Some(existing) = app_handle.get_webview_window(&name) { existing.set_focus().map_err(|e| e.to_string())?; @@ -59,17 +61,21 @@ pub async fn open_full_window( height -= 100.0; } - let window = WebviewWindowBuilder::new(&app_handle, &name, WebviewUrl::App(url.into())) + let mut builder = WebviewWindowBuilder::new(&app_handle, &name, WebviewUrl::App(url.into())) .title(&name) .inner_size(width, height) .resizable(true) .visible(false) .focused(false) .decorations(true) - // .additional_browser_args("--disable-pinch") - .zoom_hotkeys_enabled(false) - .build() - .map_err(|e| e.to_string())?; + .zoom_hotkeys_enabled(false); + + #[cfg(target_os = "macos")] + if hide_title_bar.unwrap_or(false) { + builder = builder.title_bar_style(tauri::TitleBarStyle::Overlay); + } + + let window = builder.build().map_err(|e| e.to_string())?; std::thread::sleep(std::time::Duration::from_millis(750));