mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-09 22:52:51 +02: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::KomobarTheme;
|
||||||
use crate::config::Position;
|
use crate::config::Position;
|
||||||
use crate::config::PositionConfig;
|
use crate::config::PositionConfig;
|
||||||
use crate::group::Grouping;
|
|
||||||
use crate::komorebi::Komorebi;
|
use crate::komorebi::Komorebi;
|
||||||
use crate::komorebi::KomorebiNotificationState;
|
use crate::komorebi::KomorebiNotificationState;
|
||||||
use crate::process_hwnd;
|
use crate::process_hwnd;
|
||||||
@@ -194,6 +193,8 @@ impl Komobar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.render_config.replace(config.into());
|
||||||
|
|
||||||
match config.theme {
|
match config.theme {
|
||||||
Some(theme) => {
|
Some(theme) => {
|
||||||
apply_theme(ctx, theme, self.bg_color.clone());
|
apply_theme(ctx, theme, self.bg_color.clone());
|
||||||
@@ -319,14 +320,11 @@ impl Komobar {
|
|||||||
rx_config: Receiver<KomobarConfig>,
|
rx_config: Receiver<KomobarConfig>,
|
||||||
config: Arc<KomobarConfig>,
|
config: Arc<KomobarConfig>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let conf: &KomobarConfig = &config;
|
||||||
|
|
||||||
let mut komobar = Self {
|
let mut komobar = Self {
|
||||||
config: config.clone(),
|
config: config.clone(),
|
||||||
render_config: Rc::new(RefCell::new(RenderConfig {
|
render_config: Rc::new(RefCell::new(conf.into())),
|
||||||
grouping: match config.grouping {
|
|
||||||
Some(grouping) => grouping,
|
|
||||||
None => Grouping::None,
|
|
||||||
},
|
|
||||||
})),
|
|
||||||
komorebi_notification_state: None,
|
komorebi_notification_state: None,
|
||||||
left_widgets: vec![],
|
left_widgets: vec![],
|
||||||
right_widgets: vec![],
|
right_widgets: vec![],
|
||||||
@@ -336,9 +334,9 @@ impl Komobar {
|
|||||||
scale_factor: cc.egui_ctx.native_pixels_per_point().unwrap_or(1.0),
|
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
|
// 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
|
komobar
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use crate::group::Grouping;
|
use crate::group::Grouping;
|
||||||
|
use crate::widget::RenderConfig;
|
||||||
use crate::widget::WidgetConfig;
|
use crate::widget::WidgetConfig;
|
||||||
use eframe::egui::Color32;
|
use eframe::egui::Color32;
|
||||||
use eframe::egui::Pos2;
|
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)]
|
#[derive(Clone, Debug, Serialize, Deserialize, JsonSchema)]
|
||||||
pub struct PositionConfig {
|
pub struct PositionConfig {
|
||||||
/// The desired starting position of the bar (0,0 = top left of the screen)
|
/// The desired starting position of the bar (0,0 = top left of the screen)
|
||||||
|
|||||||
Reference in New Issue
Block a user