diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index b75b73f..e6f4c90 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -5,6 +5,10 @@ "windows": ["main"], "permissions": [ "core:default", + "core:window:allow-minimize", + "core:window:allow-toggle-maximize", + "core:window:allow-close", + "core:window:allow-start-dragging", "dialog:default", "notification:default" ] diff --git a/src/components/layout/AppLayout.tsx b/src/components/layout/AppLayout.tsx index 89d460f..289afc6 100644 --- a/src/components/layout/AppLayout.tsx +++ b/src/components/layout/AppLayout.tsx @@ -1,9 +1,18 @@ +import { getCurrentWindow } from "@tauri-apps/api/window"; import { Outlet } from "react-router-dom"; import NotificationCenter from "./NotificationCenter"; import Sidebar from "./Sidebar"; import WindowControls from "./WindowControls"; export default function AppLayout() { + async function startDragging() { + try { + await getCurrentWindow().startDragging(); + } catch (error) { + console.error("Unable to drag window:", error); + } + } + return (
@@ -12,6 +21,11 @@ export default function AppLayout() {
{ + if (event.button === 0) { + void startDragging(); + } + }} className="min-w-0 flex-1 select-none text-sm font-semibold text-gray-700" > Orchai diff --git a/src/components/layout/WindowControls.tsx b/src/components/layout/WindowControls.tsx index 43abc97..09b3404 100644 --- a/src/components/layout/WindowControls.tsx +++ b/src/components/layout/WindowControls.tsx @@ -3,24 +3,24 @@ import { getCurrentWindow } from "@tauri-apps/api/window"; async function minimizeWindow() { try { await getCurrentWindow().minimize(); - } catch { - // No-op outside Tauri runtime + } catch (error) { + console.error("Unable to minimize window:", error); } } async function toggleMaximizeWindow() { try { await getCurrentWindow().toggleMaximize(); - } catch { - // No-op outside Tauri runtime + } catch (error) { + console.error("Unable to toggle maximize:", error); } } async function closeWindow() { try { await getCurrentWindow().close(); - } catch { - // No-op outside Tauri runtime + } catch (error) { + console.error("Unable to close window:", error); } }