@@ -57,6 +57,7 @@ use cosmic::{
57
57
} ,
58
58
theme:: { self , Button , TextInput } ,
59
59
widget:: {
60
+ autosize:: autosize,
60
61
button:: { self , Catalog as ButtonStyleSheet } ,
61
62
divider,
62
63
dnd_destination:: dnd_destination_for_data,
@@ -111,6 +112,8 @@ static NEW_GROUP_WINDOW_ID: Lazy<SurfaceId> = Lazy::new(|| SurfaceId::unique());
111
112
static DELETE_GROUP_WINDOW_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
112
113
pub ( crate ) static DND_ICON_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
113
114
pub ( crate ) static MENU_ID : Lazy < SurfaceId > = Lazy :: new ( || SurfaceId :: unique ( ) ) ;
115
+ pub ( crate ) static MENU_AUTOSIZE_ID : Lazy < cosmic:: widget:: Id > =
116
+ Lazy :: new ( || cosmic:: widget:: Id :: unique ( ) ) ;
114
117
115
118
#[ derive( Parser , Debug , Serialize , Deserialize , Clone ) ]
116
119
#[ command( author, version, about, long_about = None ) ]
@@ -889,26 +892,31 @@ impl cosmic::Application for CosmicAppLibrary {
889
892
) ;
890
893
}
891
894
892
- return container ( scrollable ( Column :: with_children ( list_column) ) )
893
- . padding ( [ 8 , 0 ] )
894
- . class ( theme:: Container :: Custom ( Box :: new ( |theme| {
895
- container:: Style {
896
- text_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
897
- background : Some ( Color :: from ( theme. cosmic ( ) . background . base ) . into ( ) ) ,
898
- border : Border {
899
- color : theme. cosmic ( ) . bg_divider ( ) . into ( ) ,
900
- radius : theme. cosmic ( ) . corner_radii . radius_m . into ( ) ,
901
- width : 1.0 ,
902
- } ,
903
- shadow : Shadow :: default ( ) ,
904
- icon_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
905
- }
906
- } ) ) )
907
- . width ( Length :: Shrink )
908
- . height ( Length :: Shrink )
909
- . align_x ( Horizontal :: Center )
910
- . align_y ( Vertical :: Top )
911
- . into ( ) ;
895
+ return autosize (
896
+ container ( scrollable ( Column :: with_children ( list_column) ) )
897
+ . padding ( [ 8 , 0 ] )
898
+ . class ( theme:: Container :: Custom ( Box :: new ( |theme| {
899
+ container:: Style {
900
+ text_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
901
+ background : Some ( Color :: from ( theme. cosmic ( ) . background . base ) . into ( ) ) ,
902
+ border : Border {
903
+ color : theme. cosmic ( ) . bg_divider ( ) . into ( ) ,
904
+ radius : theme. cosmic ( ) . corner_radii . radius_m . into ( ) ,
905
+ width : 1.0 ,
906
+ } ,
907
+ shadow : Shadow :: default ( ) ,
908
+ icon_color : Some ( theme. cosmic ( ) . on_bg_color ( ) . into ( ) ) ,
909
+ }
910
+ } ) ) )
911
+ . width ( Length :: Shrink )
912
+ . height ( Length :: Shrink )
913
+ . align_x ( Horizontal :: Center )
914
+ . align_y ( Vertical :: Top ) ,
915
+ MENU_AUTOSIZE_ID . clone ( ) ,
916
+ )
917
+ . max_height ( 800. )
918
+ . max_width ( 300. )
919
+ . into ( ) ;
912
920
}
913
921
if id == NEW_GROUP_WINDOW_ID . clone ( ) {
914
922
let Some ( group_name) = self . new_group . as_ref ( ) else {
0 commit comments