Skip to content

Commit

Permalink
fix(config): gen border colours only if set
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 acf201d commit cfe4062
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions komorebi/src/static_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,10 +358,22 @@ 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)),
let border_colours = if BORDER_COLOUR_SINGLE.load(Ordering::SeqCst) == 0 {
None
} else {
Option::from(ActiveWindowBorderColours {
single: Rgb::from(BORDER_COLOUR_SINGLE.load(Ordering::SeqCst)),
stack: Rgb::from(if BORDER_COLOUR_STACK.load(Ordering::SeqCst) == 0 {
BORDER_COLOUR_SINGLE.load(Ordering::SeqCst)
} else {
BORDER_COLOUR_STACK.load(Ordering::SeqCst)
}),
monocle: Rgb::from(if BORDER_COLOUR_MONOCLE.load(Ordering::SeqCst) == 0 {
BORDER_COLOUR_SINGLE.load(Ordering::SeqCst)
} else {
BORDER_COLOUR_MONOCLE.load(Ordering::SeqCst)
}),
})
};

Self {
Expand All @@ -382,7 +394,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: Option::from(border_colours),
active_window_border_colours: border_colours,
default_workspace_padding: Option::from(
DEFAULT_WORKSPACE_PADDING.load(Ordering::SeqCst),
),
Expand Down

0 comments on commit cfe4062

Please sign in to comment.