@@ -35,6 +35,9 @@ type TauriApi = {
3535const tauriApi = ( ) => ( window as unknown as { __TAURI__ ?: TauriApi } ) . __TAURI__
3636const currentDesktopWindow = ( ) => tauriApi ( ) ?. window ?. getCurrentWindow ?.( )
3737const currentThemeWindow = ( ) => tauriApi ( ) ?. webviewWindow ?. getCurrentWebviewWindow ?.( )
38+ const titlebarHeight = 40
39+ const minTitlebarZoom = 0.25
40+ const windowsControlsBaseWidth = 138 // 3 native Windows caption buttons at 46px each.
3841
3942export function Titlebar ( ) {
4043 const layout = useLayout ( )
@@ -51,7 +54,14 @@ export function Titlebar() {
5154 const windows = createMemo ( ( ) => platform . platform === "desktop" && platform . os === "windows" )
5255 const web = createMemo ( ( ) => platform . platform === "web" )
5356 const zoom = ( ) => platform . webviewZoom ?.( ) ?? 1
54- const minHeight = ( ) => ( mac ( ) ? `${ 40 / zoom ( ) } px` : undefined )
57+ const titlebarZoom = ( ) => ( windows ( ) ? Math . max ( zoom ( ) , minTitlebarZoom ) : zoom ( ) )
58+ const counterZoom = ( ) => ( windows ( ) && titlebarZoom ( ) < 1 ? 1 / titlebarZoom ( ) : 1 )
59+ const minHeight = ( ) => {
60+ if ( mac ( ) ) return `${ titlebarHeight / zoom ( ) } px`
61+ if ( windows ( ) ) return `${ titlebarHeight / Math . min ( titlebarZoom ( ) , 1 ) } px`
62+ return undefined
63+ }
64+ const windowsControlsWidth = ( ) => `${ windowsControlsBaseWidth / Math . max ( titlebarZoom ( ) , 1 ) } px`
5565
5666 const [ history , setHistory ] = createStore ( {
5767 stack : [ ] as string [ ] ,
@@ -165,12 +175,16 @@ export function Titlebar() {
165175
166176 return (
167177 < header
168- class = "h-10 shrink-0 bg-background-base relative grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center "
178+ class = "h-10 shrink-0 bg-background-base relative overflow-hidden "
169179 style = { { "min-height" : minHeight ( ) } }
170180 data-tauri-drag-region
171181 onMouseDown = { drag }
172182 onDblClick = { maximize }
173183 >
184+ < div
185+ class = "grid h-full min-h-full w-full grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center"
186+ style = { { zoom : counterZoom ( ) } }
187+ >
174188 < div
175189 classList = { {
176190 "flex items-center min-w-0" : true ,
@@ -312,10 +326,11 @@ export function Titlebar() {
312326 >
313327 < div id = "opencode-titlebar-right" class = "flex items-center gap-1 shrink-0 justify-end" />
314328 < Show when = { windows ( ) } >
315- { ! tauriApi ( ) && < div class = "w-36 shrink-0" /> }
329+ { ! tauriApi ( ) && < div class = "shrink-0" style = { { width : windowsControlsWidth ( ) } } /> }
316330 < div data-tauri-decorum-tb class = "flex flex-row" />
317331 </ Show >
318332 </ div >
333+ </ div >
319334 </ header >
320335 )
321336}
0 commit comments