Skip to content

Commit 99353b8

Browse files
CtByteLGUG2Z
authored andcommitted
fix(bar): network widget spacing
1 parent c64a42b commit 99353b8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

komorebi-bar/src/network.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -259,23 +259,24 @@ impl Network {
259259
impl BarWidget for Network {
260260
fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig) {
261261
if self.enable {
262+
// widget spacing: make sure to use the same config to call the apply_on_widget function
262263
let mut render_config = config.clone();
263264

264265
if self.show_total_activity || self.show_activity {
265266
let (activity, total_activity) = self.network_activity();
266267

267268
if self.show_total_activity {
268269
for reading in total_activity {
269-
config.apply_on_widget(true, ui, |ui| {
270-
ui.add(self.reading_to_label(ctx, reading, render_config.clone()));
270+
render_config.apply_on_widget(true, ui, |ui| {
271+
ui.add(self.reading_to_label(ctx, reading, config.clone()));
271272
});
272273
}
273274
}
274275

275276
if self.show_activity {
276277
for reading in activity {
277-
config.apply_on_widget(true, ui, |ui| {
278-
ui.add(self.reading_to_label(ctx, reading, render_config.clone()));
278+
render_config.apply_on_widget(true, ui, |ui| {
279+
ui.add(self.reading_to_label(ctx, reading, config.clone()));
279280
});
280281
}
281282
}
@@ -325,6 +326,9 @@ impl BarWidget for Network {
325326
});
326327
}
327328
}
329+
330+
// widget spacing: pass on the config that was use for calling the apply_on_widget function
331+
*config = render_config.clone();
328332
}
329333
}
330334
}

0 commit comments

Comments
 (0)