File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
packages/app/src/components Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,14 @@ export function Titlebar() {
8787
8888 const tauri = (
8989 window as unknown as {
90- __TAURI__ ?: { window ?: { getCurrentWindow ?: ( ) => { startDragging ?: ( ) => Promise < void > } } }
90+ __TAURI__ ?: {
91+ window ?: {
92+ getCurrentWindow ?: ( ) => {
93+ startDragging ?: ( ) => Promise < void >
94+ toggleMaximize ?: ( ) => Promise < void >
95+ }
96+ }
97+ }
9198 }
9299 ) . __TAURI__
93100 if ( ! tauri ?. window ?. getCurrentWindow ) return
@@ -133,10 +140,23 @@ export function Titlebar() {
133140 void win . startDragging ( ) . catch ( ( ) => undefined )
134141 }
135142
143+ const maximize = ( e : MouseEvent ) => {
144+ if ( platform . platform !== "desktop" ) return
145+ if ( interactive ( e . target ) ) return
146+ if ( e . target instanceof Element && e . target . closest ( "[data-tauri-decorum-tb]" ) ) return
147+
148+ const win = getWin ( )
149+ if ( ! win ?. toggleMaximize ) return
150+
151+ e . preventDefault ( )
152+ void win . toggleMaximize ( ) . catch ( ( ) => undefined )
153+ }
154+
136155 return (
137156 < header
138157 class = "h-10 shrink-0 bg-background-base relative grid grid-cols-[auto_minmax(0,1fr)_auto] items-center"
139158 style = { { "min-height" : minHeight ( ) } }
159+ onDblClick = { maximize }
140160 >
141161 < div
142162 classList = { {
You can’t perform that action at this time.
0 commit comments