Skip to content

Commit 4dd8ae4

Browse files
authored
Make end_separator respect separator_fg and separator_bg (greshake#2111)
This change preserves the end separator colors when separator_fg and separator_bg are set to "auto", and makes it use the configured colors when they are set. resolves greshake#2110
1 parent 9f52b65 commit 4dd8ae4

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

Diff for: src/protocol.rs

+20-4
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,28 @@ where
112112
}
113113

114114
if let Separator::Custom(end_separator) = &config.theme.end_separator {
115-
rendered_blocks.push(I3BarBlock {
115+
// The separator's FG is the last block's last widget's BG
116+
let sep_fg = if config.theme.separator_fg == Color::Auto {
117+
prev_last_bg
118+
} else {
119+
config.theme.separator_fg
120+
};
121+
122+
// The separator has no background color
123+
let sep_bg = if config.theme.separator_bg == Color::Auto {
124+
Color::None
125+
} else {
126+
config.theme.separator_bg
127+
};
128+
129+
let separator = I3BarBlock {
116130
full_text: end_separator.clone(),
117-
background: Color::None,
118-
color: prev_last_bg,
131+
background: sep_bg,
132+
color: sep_fg,
119133
..Default::default()
120-
});
134+
};
135+
136+
rendered_blocks.push(separator);
121137
}
122138

123139
println!("{},", serde_json::to_string(&rendered_blocks).unwrap());

0 commit comments

Comments
 (0)