/** * WindowsTitleBar - Conventional title bar for Windows when the native frame is hidden. * * Renders a draggable top strip with window controls (minimize, maximize/restore, close) * on the right, matching Windows conventions. Only shown in Electron on Windows (win32). */ import { useEffect, useState } from 'react'; import { isElectronMode } from '@renderer/api'; import { Minus, Square, X } from 'lucide-react'; const TITLE_BAR_HEIGHT = 32; function isWindowsDesktop(): boolean { if (!isElectronMode()) return false; return window.navigator.userAgent.includes('Windows'); } export const WindowsTitleBar = (): React.JSX.Element | null => { const [isMaximized, setIsMaximized] = useState(false); const isWin = isWindowsDesktop(); const api = typeof window !== 'undefined' ? window.electronAPI?.windowControls : null; useEffect(() => { if (api) void api.isMaximized().then(setIsMaximized); }, [api]); if (!isWin || !api) return null; const { minimize, maximize, close, isMaximized: getIsMaximized } = api; const handleMaximize = async (): Promise => { await maximize(); const maximized = await getIsMaximized(); setIsMaximized(maximized); }; const buttonBase = 'flex h-full w-12 items-center justify-center transition-colors border-0 outline-none'; const buttonHover = 'hover:bg-white/10'; const titleBarStyle = { height: `${TITLE_BAR_HEIGHT}px`, backgroundColor: 'var(--color-surface-sidebar)', borderBottom: '1px solid var(--color-border)', WebkitAppRegion: 'drag', } as React.CSSProperties; return (
{/* Draggable area — app title optional */}
claude-devtools
{/* Window controls — no-drag so they receive clicks */}
); };