@@ -8,6 +8,7 @@ use cosmic::app::Core;
8
8
use cosmic:: applet:: { self } ;
9
9
use cosmic:: cosmic_config:: { self , ConfigSet } ;
10
10
use cosmic:: iced:: wayland:: popup:: { destroy_popup, get_popup} ;
11
+ use cosmic:: iced:: widget:: { column, row} ;
11
12
use cosmic:: iced:: window:: Id ;
12
13
#[ allow( unused_imports) ]
13
14
use cosmic:: iced:: { alignment, Alignment , Length } ;
@@ -16,7 +17,7 @@ use cosmic::iced_futures::Subscription;
16
17
use cosmic:: iced_runtime:: core:: window;
17
18
use cosmic:: iced_style:: application;
18
19
use cosmic:: prelude:: * ;
19
- use cosmic:: widget;
20
+ use cosmic:: widget:: { self , horizontal_space , vertical_space } ;
20
21
use cosmic_comp_config:: CosmicCompConfig ;
21
22
use xkb_data:: KeyboardLayouts ;
22
23
@@ -161,17 +162,37 @@ impl cosmic::Application for Window {
161
162
}
162
163
163
164
fn view ( & self ) -> Element < Self :: Message > {
164
- let suggested = self . core . applet . suggested_padding ( true ) ;
165
- widget:: button (
166
- self . core . applet . text (
167
- self . active_layouts
168
- . first ( )
169
- . map_or ( String :: new ( ) , |l| l. layout . clone ( ) ) ,
170
- ) ,
165
+ let input_source_text = self . core . applet . text (
166
+ self . active_layouts
167
+ . first ( )
168
+ . map_or ( String :: new ( ) , |l| l. layout . clone ( ) ) ,
169
+ ) ;
170
+
171
+ cosmic:: widget:: button (
172
+ row ! (
173
+ column!(
174
+ input_source_text,
175
+ horizontal_space( Length :: Fixed (
176
+ ( self . core. applet. suggested_size( true ) . 0
177
+ + 2 * self . core. applet. suggested_padding( true ) )
178
+ as f32
179
+ ) )
180
+ )
181
+ . width( Length :: Shrink )
182
+ . height( Length :: Shrink )
183
+ . align_items( Alignment :: Center ) ,
184
+ vertical_space( Length :: Fixed (
185
+ ( self . core. applet. suggested_size( true ) . 1
186
+ + 2 * self . core. applet. suggested_padding( true ) ) as f32
187
+ ) )
188
+ )
189
+ . align_items ( Alignment :: Center )
190
+ . width ( Length :: Shrink )
191
+ . height ( Length :: Shrink ) ,
171
192
)
172
- . style ( cosmic:: theme:: Button :: AppletIcon )
173
- . padding ( [ suggested / 2 , suggested] )
174
193
. on_press ( Message :: TogglePopup )
194
+ . padding ( self . core . applet . suggested_padding ( true ) )
195
+ . style ( cosmic:: theme:: Button :: AppletIcon )
175
196
. into ( )
176
197
}
177
198
0 commit comments