diff --git a/src/components/TitleBar.tsx b/src/components/TitleBar.tsx new file mode 100644 index 0000000..5f7a155 --- /dev/null +++ b/src/components/TitleBar.tsx @@ -0,0 +1,66 @@ +import { useEffect, useState } from "react"; +import { getCurrentWindow } from "@tauri-apps/api/window"; +import { Minus, Square, Copy, X } from "lucide-react"; + +const appWindow = getCurrentWindow(); + +/** + * Custom Windows title bar (window has decorations: false). + * Height 40px; the drag region spans everything except the buttons. + */ +export default function TitleBar() { + const [maximized, setMaximized] = useState(false); + + useEffect(() => { + appWindow.isMaximized().then(setMaximized); + const unlisten = appWindow.onResized(async () => { + setMaximized(await appWindow.isMaximized()); + }); + return () => { + unlisten.then((f) => f()); + }; + }, []); + + return ( +