Skip to content

Commit 308963b

Browse files
committed
fix(desktop): restore custom titlebar window dragging
Replace Electron-style -webkit-app-region with Tauri 2 data-tauri-drag-region and enable acceptFirstMouse for drag on unfocused macOS windows. Signed-off-by: crimsonsunset <jsangio1@gmail.com>
1 parent b7016de commit 308963b

4 files changed

Lines changed: 22 additions & 12 deletions

File tree

apps/desktop/src-tauri/tauri.conf.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
"minHeight": 600,
3737
"center": true,
3838
"preventOverflow": true,
39-
"decorations": false
39+
"decorations": false,
40+
"acceptFirstMouse": true
4041
}
4142
],
4243
"security": {

apps/desktop/src/App.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,22 @@ function AppContent() {
296296
);
297297

298298
const titleBar = (
299-
<div className="flex items-center gap-1.5 pl-3">
300-
<McpMuxGlyph className="h-4 w-4 shrink-0" />
301-
<span className="text-sm font-bold tracking-tight select-none">
302-
<span style={{ color: 'var(--brand-light)' }}>Mcp</span>
303-
<span style={{ color: 'var(--brand-dark)' }}>Mux</span>
304-
</span>
305-
<div className="mx-2 h-4 w-px bg-[rgb(var(--border))]" />
299+
<div className="flex h-full w-full items-center pl-3">
300+
<div
301+
data-tauri-drag-region
302+
className="flex h-full min-w-0 flex-1 items-center gap-1.5"
303+
>
304+
<McpMuxGlyph className="pointer-events-none h-4 w-4 shrink-0" />
305+
<span className="pointer-events-none select-none text-sm font-bold tracking-tight">
306+
<span style={{ color: 'var(--brand-light)' }}>Mcp</span>
307+
<span style={{ color: 'var(--brand-dark)' }}>Mux</span>
308+
</span>
309+
<div className="pointer-events-none mx-2 h-4 w-px bg-[rgb(var(--border))]" />
310+
</div>
306311
<button
312+
type="button"
307313
onClick={toggleDarkMode}
308-
className="p-1 rounded-md hover:bg-[rgb(var(--surface-hover))] transition-colors"
314+
className="no-drag rounded-md p-1 transition-colors hover:bg-[rgb(var(--surface-hover))]"
309315
title={theme === 'dark' ? 'Light mode' : 'Dark mode'}
310316
>
311317
{theme === 'dark' ? <Sun className="h-3.5 w-3.5 text-[rgb(var(--muted))]" /> : <Moon className="h-3.5 w-3.5 text-[rgb(var(--muted))]" />}

apps/desktop/src/index.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,10 +194,13 @@
194194
}
195195

196196
@layer utilities {
197-
.drag-region {
197+
/* Tauri 2 custom titlebar — see https://v2.tauri.app/learn/window-customization/ */
198+
[data-tauri-drag-region] {
199+
app-region: drag;
198200
-webkit-app-region: drag;
199201
}
200202
.no-drag {
203+
app-region: no-drag;
201204
-webkit-app-region: no-drag;
202205
}
203206

packages/ui/src/components/layout/AppShell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export function AppShell({ sidebar, children, statusBar, titleBar, windowControl
1616
{/* Custom title bar */}
1717
{titleBar && (
1818
<div className="h-9 flex-shrink-0 bg-[rgb(var(--surface))] border-b border-[rgb(var(--border-subtle))] flex items-center">
19-
{/* Draggable area — fills space between logo and window controls */}
20-
<div className="drag-region flex-1 h-full flex items-center">
19+
{/* Draggable area — titleBar marks regions with data-tauri-drag-region (Tauri 2) */}
20+
<div className="flex-1 h-full flex items-center min-w-0">
2121
{titleBar}
2222
</div>
2323
{/* Window controls — outside drag region so clicks work */}

0 commit comments

Comments
 (0)