File tree Expand file tree Collapse file tree 4 files changed +31
-0
lines changed
core/tauri-runtime-wry/src Expand file tree Collapse file tree 4 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ ---
3+ "cli.rs": patch
4+ "tauri-runtime-wry": patch
5+ ---
6+
7+ Fixes ` center ` and ` focus ` not being allowed in ` tauri.conf.json > tauri > windows ` and ignored in ` WindowBuilderWrapper ` .
Original file line number Diff line number Diff line change @@ -442,6 +442,10 @@ impl WindowBuilder for WindowBuilderWrapper {
442442 window = window. position ( x, y) ;
443443 }
444444
445+ if config. center {
446+ window = window. center ( ) ;
447+ }
448+
445449 if config. focus {
446450 window = window. focus ( ) ;
447451 }
Original file line number Diff line number Diff line change @@ -268,6 +268,9 @@ pub struct WindowConfig {
268268 /// Disabling it is required to use drag and drop on the frontend on Windows.
269269 #[ serde( default = "default_file_drop_enabled" ) ]
270270 pub file_drop_enabled : bool ,
271+ /// Whether or not the window starts centered or not.
272+ #[ serde( default ) ]
273+ pub center : bool ,
271274 /// The horizontal position of the window's top left corner
272275 pub x : Option < f64 > ,
273276 /// The vertical position of the window's top left corner
@@ -292,6 +295,9 @@ pub struct WindowConfig {
292295 /// Whether the window starts as fullscreen or not.
293296 #[ serde( default ) ]
294297 pub fullscreen : bool ,
298+ /// Whether the window will be initially hidden or focused.
299+ #[ serde( default = "default_focus" ) ]
300+ pub focus : bool ,
295301 /// Whether the window is transparent or not.
296302 #[ serde( default ) ]
297303 pub transparent : bool ,
@@ -312,6 +318,10 @@ pub struct WindowConfig {
312318 pub skip_taskbar : bool ,
313319}
314320
321+ fn default_focus ( ) -> bool {
322+ true
323+ }
324+
315325fn default_visible ( ) -> bool {
316326 true
317327}
Original file line number Diff line number Diff line change 10991099 "default" : false ,
11001100 "type" : " boolean"
11011101 },
1102+ "center" : {
1103+ "description" : " Whether or not the window starts centered or not." ,
1104+ "default" : false ,
1105+ "type" : " boolean"
1106+ },
11021107 "decorations" : {
11031108 "description" : " Whether the window should have borders and bars." ,
11041109 "default" : true ,
11091114 "default" : true ,
11101115 "type" : " boolean"
11111116 },
1117+ "focus" : {
1118+ "description" : " Whether the window will be initially hidden or focused." ,
1119+ "default" : true ,
1120+ "type" : " boolean"
1121+ },
11121122 "fullscreen" : {
11131123 "description" : " Whether the window starts as fullscreen or not." ,
11141124 "default" : false ,
You can’t perform that action at this time.
0 commit comments