mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-06-12 13:34:26 +02:00
fix(bar): update widgets background color properly
Previously when changing between themes with different backgrounds the widget's background color was not updating because they take the bg color from the `RenderConfig` which was only being updated on `apply_config`, now we also pass the `RenderConfig` to the `apply_theme` function and update it's `background_color` there as well.
This commit is contained in:
@@ -71,6 +71,7 @@ pub fn apply_theme(
|
|||||||
bg_color_with_alpha: Rc<RefCell<Color32>>,
|
bg_color_with_alpha: Rc<RefCell<Color32>>,
|
||||||
transparency_alpha: Option<u8>,
|
transparency_alpha: Option<u8>,
|
||||||
grouping: Option<Grouping>,
|
grouping: Option<Grouping>,
|
||||||
|
render_config: Rc<RefCell<RenderConfig>>,
|
||||||
) {
|
) {
|
||||||
match theme {
|
match theme {
|
||||||
KomobarTheme::Catppuccin {
|
KomobarTheme::Catppuccin {
|
||||||
@@ -171,6 +172,9 @@ pub fn apply_theme(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update RenderConfig's background_color so that widgets will have the new color
|
||||||
|
render_config.borrow_mut().background_color = *bg_color.borrow();
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Komobar {
|
impl Komobar {
|
||||||
@@ -364,6 +368,7 @@ impl Komobar {
|
|||||||
self.bg_color_with_alpha.clone(),
|
self.bg_color_with_alpha.clone(),
|
||||||
config.transparency_alpha,
|
config.transparency_alpha,
|
||||||
config.grouping,
|
config.grouping,
|
||||||
|
self.render_config.clone(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
@@ -393,6 +398,7 @@ impl Komobar {
|
|||||||
self.bg_color_with_alpha.clone(),
|
self.bg_color_with_alpha.clone(),
|
||||||
bar_transparency_alpha,
|
bar_transparency_alpha,
|
||||||
bar_grouping,
|
bar_grouping,
|
||||||
|
self.render_config.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let stack_accent = match theme {
|
let stack_accent = match theme {
|
||||||
@@ -555,6 +561,7 @@ impl eframe::App for Komobar {
|
|||||||
self.config.transparency_alpha,
|
self.config.transparency_alpha,
|
||||||
self.config.grouping,
|
self.config.grouping,
|
||||||
self.config.theme,
|
self.config.theme,
|
||||||
|
self.render_config.clone(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -502,6 +502,7 @@ impl KomorebiNotificationState {
|
|||||||
transparency_alpha: Option<u8>,
|
transparency_alpha: Option<u8>,
|
||||||
grouping: Option<Grouping>,
|
grouping: Option<Grouping>,
|
||||||
default_theme: Option<KomobarTheme>,
|
default_theme: Option<KomobarTheme>,
|
||||||
|
render_config: Rc<RefCell<RenderConfig>>,
|
||||||
) {
|
) {
|
||||||
match rx_gui.try_recv() {
|
match rx_gui.try_recv() {
|
||||||
Err(error) => match error {
|
Err(error) => match error {
|
||||||
@@ -526,6 +527,7 @@ impl KomorebiNotificationState {
|
|||||||
bg_color_with_alpha.clone(),
|
bg_color_with_alpha.clone(),
|
||||||
transparency_alpha,
|
transparency_alpha,
|
||||||
grouping,
|
grouping,
|
||||||
|
render_config,
|
||||||
);
|
);
|
||||||
tracing::info!("applied theme from updated komorebi.json");
|
tracing::info!("applied theme from updated komorebi.json");
|
||||||
} else if let Some(default_theme) = default_theme {
|
} else if let Some(default_theme) = default_theme {
|
||||||
@@ -536,6 +538,7 @@ impl KomorebiNotificationState {
|
|||||||
bg_color_with_alpha.clone(),
|
bg_color_with_alpha.clone(),
|
||||||
transparency_alpha,
|
transparency_alpha,
|
||||||
grouping,
|
grouping,
|
||||||
|
render_config,
|
||||||
);
|
);
|
||||||
tracing::info!("removed theme from updated komorebi.json and applied default theme");
|
tracing::info!("removed theme from updated komorebi.json and applied default theme");
|
||||||
} else {
|
} else {
|
||||||
@@ -551,6 +554,7 @@ impl KomorebiNotificationState {
|
|||||||
bg_color_with_alpha.clone(),
|
bg_color_with_alpha.clone(),
|
||||||
transparency_alpha,
|
transparency_alpha,
|
||||||
grouping,
|
grouping,
|
||||||
|
render_config,
|
||||||
);
|
);
|
||||||
tracing::info!("applied theme from komorebi socket message");
|
tracing::info!("applied theme from komorebi socket message");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user