Skip to content

Commit

Permalink
feat(config): border colours in static config gen
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Blacker authored and LGUG2Z committed Jul 19, 2023
1 parent fa4d147 commit acf201d
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion komorebi/src/static_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ pub struct Rgb {
pub b: u32,
}

impl From<u32> for Rgb {
fn from(value: u32) -> Self {
Self {
r: value & 0xff,
g: value >> 8 & 0xff,
b: value >> 16 & 0xff
}
}
}

#[derive(Debug, Serialize, Deserialize, JsonSchema)]
pub struct ActiveWindowBorderColours {
/// Border colour when the container contains a single window
Expand Down Expand Up @@ -348,6 +358,12 @@ impl From<&WindowManager> for StaticConfig {
}
}

let border_colours = ActiveWindowBorderColours {
single: Rgb::from(BORDER_COLOUR_SINGLE.load(Ordering::SeqCst)),
stack: Rgb::from(BORDER_COLOUR_STACK.load(Ordering::SeqCst)),
monocle: Rgb::from(BORDER_COLOUR_MONOCLE.load(Ordering::SeqCst)),
};

Self {
invisible_borders: if value.invisible_borders == default_invisible_borders {
None
Expand All @@ -366,7 +382,7 @@ impl From<&WindowManager> for StaticConfig {
border_width: Option::from(BORDER_WIDTH.load(Ordering::SeqCst)),
border_offset: *BORDER_OFFSET.lock(),
active_window_border: Option::from(BORDER_ENABLED.load(Ordering::SeqCst)),
active_window_border_colours: None,
active_window_border_colours: Option::from(border_colours),
default_workspace_padding: Option::from(
DEFAULT_WORKSPACE_PADDING.load(Ordering::SeqCst),
),
Expand All @@ -384,6 +400,8 @@ impl From<&WindowManager> for StaticConfig {
layered_applications: None,
object_name_change_applications: None,
}


}
}

Expand Down

0 comments on commit acf201d

Please sign in to comment.