mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-25 10:51:39 +01:00
hot-reload on grouping
This commit is contained in:
@@ -2,7 +2,6 @@ use crate::config::KomobarConfig;
|
||||
use crate::config::KomobarTheme;
|
||||
use crate::config::Position;
|
||||
use crate::config::PositionConfig;
|
||||
use crate::group::Grouping;
|
||||
use crate::komorebi::Komorebi;
|
||||
use crate::komorebi::KomorebiNotificationState;
|
||||
use crate::process_hwnd;
|
||||
@@ -194,6 +193,8 @@ impl Komobar {
|
||||
}
|
||||
}
|
||||
|
||||
self.render_config.replace(config.into());
|
||||
|
||||
match config.theme {
|
||||
Some(theme) => {
|
||||
apply_theme(ctx, theme, self.bg_color.clone());
|
||||
@@ -319,14 +320,11 @@ impl Komobar {
|
||||
rx_config: Receiver<KomobarConfig>,
|
||||
config: Arc<KomobarConfig>,
|
||||
) -> Self {
|
||||
let conf: &KomobarConfig = &config;
|
||||
|
||||
let mut komobar = Self {
|
||||
config: config.clone(),
|
||||
render_config: Rc::new(RefCell::new(RenderConfig {
|
||||
grouping: match config.grouping {
|
||||
Some(grouping) => grouping,
|
||||
None => Grouping::None,
|
||||
},
|
||||
})),
|
||||
render_config: Rc::new(RefCell::new(conf.into())),
|
||||
komorebi_notification_state: None,
|
||||
left_widgets: vec![],
|
||||
right_widgets: vec![],
|
||||
@@ -336,9 +334,9 @@ impl Komobar {
|
||||
scale_factor: cc.egui_ctx.native_pixels_per_point().unwrap_or(1.0),
|
||||
};
|
||||
|
||||
komobar.apply_config(&cc.egui_ctx, &config, None);
|
||||
komobar.apply_config(&cc.egui_ctx, conf, None);
|
||||
// needs a double apply the first time for some reason
|
||||
komobar.apply_config(&cc.egui_ctx, &config, None);
|
||||
komobar.apply_config(&cc.egui_ctx, conf, None);
|
||||
|
||||
komobar
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
use crate::group::Grouping;
|
||||
use crate::widget::RenderConfig;
|
||||
use crate::widget::WidgetConfig;
|
||||
use eframe::egui::Color32;
|
||||
use eframe::egui::Pos2;
|
||||
@@ -70,6 +71,17 @@ impl KomobarConfig {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&KomobarConfig> for RenderConfig {
|
||||
fn from(value: &KomobarConfig) -> Self {
|
||||
RenderConfig {
|
||||
grouping: match value.grouping {
|
||||
Some(grouping) => grouping,
|
||||
None => Grouping::None,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
||||
pub struct PositionConfig {
|
||||
/// The desired starting position of the bar (0,0 = top left of the screen)
|
||||
|
||||
Reference in New Issue
Block a user