From 99353b80641873aac3fa49135cbb9b3a53b0e960 Mon Sep 17 00:00:00 2001 From: Csaba Date: Thu, 19 Dec 2024 19:56:57 +0100 Subject: [PATCH] fix(bar): network widget spacing --- komorebi-bar/src/network.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/komorebi-bar/src/network.rs b/komorebi-bar/src/network.rs index 3adbb466..c996d969 100644 --- a/komorebi-bar/src/network.rs +++ b/komorebi-bar/src/network.rs @@ -259,6 +259,7 @@ impl Network { impl BarWidget for Network { fn render(&mut self, ctx: &Context, ui: &mut Ui, config: &mut RenderConfig) { if self.enable { + // widget spacing: make sure to use the same config to call the apply_on_widget function let mut render_config = config.clone(); if self.show_total_activity || self.show_activity { @@ -266,16 +267,16 @@ impl BarWidget for Network { if self.show_total_activity { for reading in total_activity { - config.apply_on_widget(true, ui, |ui| { - ui.add(self.reading_to_label(ctx, reading, render_config.clone())); + render_config.apply_on_widget(true, ui, |ui| { + ui.add(self.reading_to_label(ctx, reading, config.clone())); }); } } if self.show_activity { for reading in activity { - config.apply_on_widget(true, ui, |ui| { - ui.add(self.reading_to_label(ctx, reading, render_config.clone())); + render_config.apply_on_widget(true, ui, |ui| { + ui.add(self.reading_to_label(ctx, reading, config.clone())); }); } } @@ -325,6 +326,9 @@ impl BarWidget for Network { }); } } + + // widget spacing: pass on the config that was use for calling the apply_on_widget function + *config = render_config.clone(); } } }