@@ -100,6 +100,9 @@ impl Window {
100100 }
101101
102102 fn settings_view ( & self ) -> Vec < Element < Message > > {
103+ if !self . show_settings {
104+ return Vec :: with_capacity ( 0 ) ;
105+ }
103106 self . monitors
104107 . iter ( )
105108 . map ( |( id, monitor) | {
@@ -132,11 +135,12 @@ impl Window {
132135 }
133136
134137 fn settings_collapsible_view ( & self ) -> Vec < Element < Message > > {
135- let mut vec = Vec :: with_capacity ( 3 ) ;
138+ let mut vec = Vec :: with_capacity ( 2 ) ;
136139 // vec.push(padded_control(divider::horizontal::default()).into());
137- if ! self . monitors . is_empty ( ) {
138- vec. push ( padded_control ( divider :: horizontal :: default ( ) ) . into ( ) ) ;
140+ if self . monitors . is_empty ( ) {
141+ return vec;
139142 }
143+ vec. push ( padded_control ( divider:: horizontal:: default ( ) ) . into ( ) ) ;
140144
141145 let dropdown_icon = if self . show_settings {
142146 "go-up-symbolic"
@@ -165,7 +169,7 @@ impl Window {
165169 }
166170
167171 fn dark_mode_view ( & self ) -> Vec < Element < Message > > {
168- let mut vec = Vec :: with_capacity ( 3 ) ;
172+ let mut vec = Vec :: with_capacity ( 2 ) ;
169173 if !self . monitors . is_empty ( ) {
170174 vec. push ( padded_control ( divider:: horizontal:: default ( ) ) . into ( ) ) ;
171175 }
@@ -376,10 +380,11 @@ impl cosmic::Application for Window {
376380 . padding ( [ 8 , 0 ] )
377381 . extend ( self . sliders_view ( ) )
378382 . extend ( self . dark_mode_view ( ) )
379- . extend ( self . settings_collapsible_view ( ) ) ;
380- if self . show_settings {
381- col = col. extend ( self . settings_view ( ) )
382- }
383+ . extend ( self . settings_collapsible_view ( ) )
384+ . extend ( self . settings_view ( ) ) ;
385+ // if self.show_settings {
386+ // col = col.extend(self.settings_view())
387+ // }
383388 self . core . applet . popup_container ( col) . into ( )
384389 }
385390
0 commit comments