feat: custom TitleBar with window controls (no native decorations) #7
@@ -58,7 +58,10 @@ export function TitleBar() {
|
|||||||
const handleClose = () => appWindow.close();
|
const handleClose = () => appWindow.close();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
// data-tauri-drag-region is the recommended Tauri approach for drag regions.
|
||||||
|
// WebkitAppRegion is kept as a CSS fallback for compatibility.
|
||||||
<div
|
<div
|
||||||
|
data-tauri-drag-region
|
||||||
className="titlebar relative z-50 flex h-9 shrink-0 items-center bg-gray-950 select-none"
|
className="titlebar relative z-50 flex h-9 shrink-0 items-center bg-gray-950 select-none"
|
||||||
style={{ WebkitAppRegion: "drag" } as React.CSSProperties}
|
style={{ WebkitAppRegion: "drag" } as React.CSSProperties}
|
||||||
>
|
>
|
||||||
|
|
|||||||
@@ -75,7 +78,7 @@ export function TitleBar() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Spacer — draggable region fills here */}
|
{/* Spacer — draggable region fills here */}
|
||||||
<div className="flex-1" />
|
<div data-tauri-drag-region className="flex-1" />
|
||||||
|
|
||||||
{/* Window control buttons — right side, non-draggable */}
|
{/* Window control buttons — right side, non-draggable */}
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user
The title bar drag region is implemented only via
WebkitAppRegion: "drag". In Tauri (especially on Windows/Linux with WebView2), this CSS property is not reliably honored; the recommended approach is to mark draggable areas withdata-tauri-drag-region(and/or explicitly callappWindow.startDragging()on pointer-down). As-is, the window may not be draggable and the PR description’sdata-tauri-drag-regionbehavior isn’t present.