From 7c99a6d986b4be5d64df5f54b01ef73f65964ed5 Mon Sep 17 00:00:00 2001 From: thibaud-leclere Date: Tue, 14 Apr 2026 10:45:13 +0200 Subject: [PATCH] feat: add custom tauri title bar and window controls --- src-tauri/tauri.conf.json | 3 +- src/components/layout/AppLayout.tsx | 12 ++++- src/components/layout/WindowControls.tsx | 56 ++++++++++++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 src/components/layout/WindowControls.tsx diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index aa68e57..2fc7f8e 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -14,7 +14,8 @@ { "title": "Orchai", "width": 1200, - "height": 800 + "height": 800, + "decorations": false } ], "security": { diff --git a/src/components/layout/AppLayout.tsx b/src/components/layout/AppLayout.tsx index 61cda31..89d460f 100644 --- a/src/components/layout/AppLayout.tsx +++ b/src/components/layout/AppLayout.tsx @@ -1,15 +1,23 @@ import { Outlet } from "react-router-dom"; import NotificationCenter from "./NotificationCenter"; import Sidebar from "./Sidebar"; +import WindowControls from "./WindowControls"; export default function AppLayout() { return (
-
-
+
+
+
+ Orchai +
+
diff --git a/src/components/layout/WindowControls.tsx b/src/components/layout/WindowControls.tsx new file mode 100644 index 0000000..43abc97 --- /dev/null +++ b/src/components/layout/WindowControls.tsx @@ -0,0 +1,56 @@ +import { getCurrentWindow } from "@tauri-apps/api/window"; + +async function minimizeWindow() { + try { + await getCurrentWindow().minimize(); + } catch { + // No-op outside Tauri runtime + } +} + +async function toggleMaximizeWindow() { + try { + await getCurrentWindow().toggleMaximize(); + } catch { + // No-op outside Tauri runtime + } +} + +async function closeWindow() { + try { + await getCurrentWindow().close(); + } catch { + // No-op outside Tauri runtime + } +} + +export default function WindowControls() { + return ( +
+ + + +
+ ); +}