diff --git a/packages/app/src/components/titlebar.tsx b/packages/app/src/components/titlebar.tsx index d8735410a..2e22dc633 100644 --- a/packages/app/src/components/titlebar.tsx +++ b/packages/app/src/components/titlebar.tsx @@ -83,7 +83,14 @@ export function Titlebar() { const tauri = ( window as unknown as { - __TAURI__?: { window?: { getCurrentWindow?: () => { startDragging?: () => Promise } } } + __TAURI__?: { + window?: { + getCurrentWindow?: () => { + startDragging?: () => Promise + toggleMaximize?: () => Promise + } + } + } } ).__TAURI__ if (!tauri?.window?.getCurrentWindow) return @@ -129,10 +136,23 @@ export function Titlebar() { void win.startDragging().catch(() => undefined) } + const maximize = (e: MouseEvent) => { + if (platform.platform !== "desktop") return + if (interactive(e.target)) return + if (e.target instanceof Element && e.target.closest("[data-tauri-decorum-tb]")) return + + const win = getWin() + if (!win?.toggleMaximize) return + + e.preventDefault() + void win.toggleMaximize().catch(() => undefined) + } + return (