@@ -143,6 +143,7 @@ impl Component for App {
143
143
}
144
144
} ,
145
145
146
+ #[ name = "main" ]
146
147
gtk:: Box {
147
148
set_orientation: gtk:: Orientation :: Vertical ,
148
149
set_halign: gtk:: Align :: Center ,
@@ -325,10 +326,25 @@ impl Component for App {
325
326
let height = self . config . height . to_val ( mon_height) ;
326
327
let y = self . config . y . to_val ( mon_height) - height / 2 ;
327
328
328
- window. set_default_size ( width, height) ;
329
- window. child ( ) . unwrap ( ) . set_size_request ( width, height) ;
330
- window. set_margin ( Edge :: Left , x) ;
331
- window. set_margin ( Edge :: Top , y) ;
329
+ if self . config . close_on_click {
330
+ window. set_anchor ( Edge :: Bottom , true ) ;
331
+ window. set_anchor ( Edge :: Right , true ) ;
332
+ widgets. main . set_halign ( gtk:: Align :: Fill ) ;
333
+ widgets. main . set_margin_start ( x) ;
334
+ widgets. main . set_margin_top ( y) ;
335
+ widgets
336
+ . main
337
+ . set_margin_end ( mon_width as i32 - x - width) ;
338
+ widgets
339
+ . main
340
+ . set_margin_bottom ( mon_height as i32 - y - height) ;
341
+ } else {
342
+ window. set_default_size ( width, height) ;
343
+ window. child ( ) . unwrap ( ) . set_size_request ( width, height) ;
344
+ window. set_margin ( Edge :: Left , x) ;
345
+ window. set_margin ( Edge :: Top , y) ;
346
+ }
347
+
332
348
window. show ( ) ;
333
349
}
334
350
AppMsg :: KeyPressed { key, modifier } => {
0 commit comments