@@ -3,19 +3,19 @@ mod subscriptions;
3
3
4
4
use cosmic:: cosmic_config:: { config_subscription, Config , CosmicConfigEntry } ;
5
5
use cosmic:: iced:: wayland:: popup:: { destroy_popup, get_popup} ;
6
+ use cosmic:: iced:: Limits ;
6
7
use cosmic:: iced:: {
7
8
widget:: { button, column, row, text, Row , Space } ,
8
9
window, Alignment , Application , Color , Command , Length , Subscription ,
9
10
} ;
10
11
use cosmic:: iced_core:: alignment:: Horizontal ;
11
- use cosmic:: iced_core:: { image, Widget } ;
12
- use cosmic:: iced_futures:: subscription;
12
+ use cosmic:: iced_core:: image;
13
13
use cosmic:: iced_widget:: button:: StyleSheet ;
14
14
use cosmic_applet:: { applet_button_theme, CosmicAppletHelper } ;
15
15
16
16
use cosmic:: iced_style:: application:: { self , Appearance } ;
17
17
18
- use cosmic:: iced_widget:: { horizontal_space , scrollable, Column } ;
18
+ use cosmic:: iced_widget:: { scrollable, Column } ;
19
19
use cosmic:: theme:: { Button , Svg } ;
20
20
use cosmic:: widget:: { container, divider, icon} ;
21
21
use cosmic:: Renderer ;
@@ -172,13 +172,18 @@ impl Application for Notifications {
172
172
let new_id = window:: Id ( self . id_ctr ) ;
173
173
self . popup . replace ( new_id) ;
174
174
175
- let popup_settings = self . applet_helper . get_popup_settings (
175
+ let mut popup_settings = self . applet_helper . get_popup_settings (
176
176
window:: Id ( 0 ) ,
177
177
new_id,
178
178
None ,
179
179
None ,
180
180
None ,
181
181
) ;
182
+ popup_settings. positioner . size_limits = Limits :: NONE
183
+ . min_width ( 1.0 )
184
+ . max_width ( 300.0 )
185
+ . min_height ( 100.0 )
186
+ . max_height ( 600.0 ) ;
182
187
get_popup ( popup_settings)
183
188
}
184
189
}
@@ -287,9 +292,11 @@ impl Application for Notifications {
287
292
column ! [ cosmic:: widget:: button( Button :: Text )
288
293
. custom( vec![ text( fl!( "clear-all" ) ) . size( 14 ) . into( ) ] )
289
294
. on_press( Message :: ClearAll ) ]
295
+ . align_items ( Alignment :: End )
296
+ . width ( Length :: Fill )
290
297
. into ( ) ,
291
298
) ;
292
- for n in & self . notifications {
299
+ for n in self . notifications . iter ( ) . rev ( ) {
293
300
let app_name = text ( if n. app_name . len ( ) > 24 {
294
301
Cow :: from ( format ! (
295
302
"{:.26}..." ,
@@ -312,12 +319,8 @@ impl Application for Notifications {
312
319
} else {
313
320
Button :: Secondary
314
321
} ;
315
- let cosmic = t. cosmic ( ) ;
316
322
let mut a = t. active ( & style) ;
317
323
a. border_radius = 8.0 . into ( ) ;
318
- a. background = Some ( Color :: from ( cosmic. bg_color ( ) ) . into ( ) ) ;
319
- a. border_color = Color :: from ( cosmic. bg_divider ( ) ) ;
320
- a. border_width = 1.0 ;
321
324
a
322
325
} ) ,
323
326
hover : Box :: new ( move |t| {
@@ -326,12 +329,8 @@ impl Application for Notifications {
326
329
} else {
327
330
Button :: Secondary
328
331
} ;
329
- let cosmic = t. cosmic ( ) ;
330
332
let mut a = t. hovered ( & style) ;
331
333
a. border_radius = 8.0 . into ( ) ;
332
- a. background = Some ( Color :: from ( cosmic. bg_color ( ) ) . into ( ) ) ;
333
- a. border_color = Color :: from ( cosmic. bg_divider ( ) ) ;
334
- a. border_width = 1.0 ;
335
334
a
336
335
} ) ,
337
336
} )
@@ -368,7 +367,8 @@ impl Application for Notifications {
368
367
} else {
369
368
Cow :: from( & n. summary)
370
369
} )
371
- . size( 14 ) ,
370
+ . size( 14 )
371
+ . width( Length :: Fixed ( 300.0 ) ) ,
372
372
text( if n. body. len( ) > 77 {
373
373
Cow :: from( format!(
374
374
"{:.80}..." ,
@@ -377,11 +377,12 @@ impl Application for Notifications {
377
377
} else {
378
378
Cow :: from( & n. body)
379
379
} )
380
- . size( 12 ) ,
381
- horizontal_space ( Length :: Fixed ( 300.0 ) ) ,
380
+ . size( 12 )
381
+ . width ( Length :: Fixed ( 300.0 ) ) ,
382
382
)
383
383
. spacing( 8 )
384
384
. into( ) ] )
385
+ . padding ( 16 )
385
386
. on_press ( Message :: Dismissed ( n. id ) )
386
387
. into ( ) ,
387
388
) ;
@@ -393,7 +394,7 @@ impl Application for Notifications {
393
394
. height( Length :: Shrink ) ,
394
395
)
395
396
. width( Length :: Shrink )
396
- . height( Length :: Fixed ( 400.0 ) ) )
397
+ . height( Length :: Shrink ) )
397
398
. width ( Length :: Shrink )
398
399
} ;
399
400
@@ -405,13 +406,10 @@ impl Application for Notifications {
405
406
. padding ( [ 0 , 24 ] )
406
407
. spacing ( 12 ) ;
407
408
408
- let content = column ! [ ]
409
+ let content = column ! [ do_not_disturb , main_content , settings ]
409
410
. align_items ( Alignment :: Start )
410
411
. spacing ( 12 )
411
- . padding ( [ 12 , 0 ] )
412
- . push ( do_not_disturb)
413
- . push ( main_content)
414
- . push ( settings) ;
412
+ . padding ( [ 12 , 0 ] ) ;
415
413
416
414
self . applet_helper . popup_container ( content) . into ( )
417
415
}
0 commit comments