From ce49b433f9787a9360954e9c8bc2c90e08542a75 Mon Sep 17 00:00:00 2001 From: Csaba Date: Thu, 7 Nov 2024 10:42:04 +0100 Subject: [PATCH] GroupingConfig --- komorebi-bar/src/config.rs | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/komorebi-bar/src/config.rs b/komorebi-bar/src/config.rs index b1be2eb5..164a2c88 100644 --- a/komorebi-bar/src/config.rs +++ b/komorebi-bar/src/config.rs @@ -1,5 +1,6 @@ use crate::widget::WidgetConfig; use eframe::egui::Pos2; +use eframe::egui::Rounding; use eframe::egui::TextBuffer; use eframe::egui::Vec2; use komorebi_client::KomorebiTheme; @@ -183,5 +184,38 @@ pub enum LabelPrefix { #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] pub enum Grouping { - None + /// No grouping is applied + None, + /// Widgets are grouped individually + Widget(GroupingConfig), + /// Widgets are grouped on each side + Side(GroupingConfig), +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] +pub struct GroupingConfig { + pub rounding: Option, +} + +#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema)] +pub struct BorderRadius { + /// Radius of the rounding of the North-West (left top) corner. + pub nw: f32, + /// Radius of the rounding of the North-East (right top) corner. + pub ne: f32, + /// Radius of the rounding of the South-West (left bottom) corner. + pub sw: f32, + /// Radius of the rounding of the South-East (right bottom) corner. + pub se: f32, +} + +impl From for Rounding { + fn from(value: BorderRadius) -> Self { + Self { + nw: value.nw, + ne: value.ne, + sw: value.sw, + se: value.se, + } + } } \ No newline at end of file