color_t bar_fg;
color_t bar_bg;
color_t sep_fg;
+ color_t focus_bar_fg;
+ color_t focus_bar_bg;
+ color_t focus_sep_fg;
color_t active_ws_fg;
color_t active_ws_bg;
color_t active_ws_border;
* Draws a separator for the given block if necessary.
*
*/
-static void draw_separator(i3_output *output, uint32_t x, struct status_block *block) {
+static void draw_separator(i3_output *output, uint32_t x, struct status_block *block, bool use_focus_colors) {
+ color_t sep_fg = (use_focus_colors ? colors.focus_sep_fg : colors.sep_fg);
+ color_t bar_bg = (use_focus_colors ? colors.focus_bar_bg : colors.bar_bg);
+
uint32_t sep_offset = get_sep_offset(block);
if (TAILQ_NEXT(block, blocks) == NULL || sep_offset == 0)
return;
uint32_t center_x = x - sep_offset;
if (config.separator_symbol == NULL) {
/* Draw a classic one pixel, vertical separator. */
- draw_util_rectangle(&output->statusline_buffer, colors.sep_fg,
+ draw_util_rectangle(&output->statusline_buffer, sep_fg,
center_x,
logical_px(sep_voff_px),
logical_px(1),
} else {
/* Draw a custom separator. */
uint32_t separator_x = MAX(x - block->sep_block_width, center_x - separator_symbol_width / 2);
- draw_util_text(config.separator_symbol, &output->statusline_buffer, colors.sep_fg, colors.bar_bg,
+ draw_util_text(config.separator_symbol, &output->statusline_buffer, sep_fg, bar_bg,
separator_x, logical_px(ws_voff_px), x - separator_x);
}
}
/*
* Redraws the statusline to the output's statusline_buffer
*/
-void draw_statusline(i3_output *output, uint32_t clip_left, bool use_short_text) {
+void draw_statusline(i3_output *output, uint32_t clip_left, bool use_focus_colors, bool use_short_text) {
struct status_block *block;
- draw_util_clear_surface(&output->statusline_buffer, colors.bar_bg);
+ color_t bar_color = (use_focus_colors ? colors.focus_bar_bg : colors.bar_bg);
+ draw_util_clear_surface(&output->statusline_buffer, bar_color);
/* Use unsigned integer wraparound to clip off the left side.
* For example, if clip_left is 75, then x will start at the very large
fg_color = colors.urgent_ws_fg;
} else if (block->color) {
fg_color = draw_util_hex_to_color(block->color);
+ } else if (use_focus_colors) {
+ fg_color = colors.focus_bar_fg;
} else {
fg_color = colors.bar_fg;
}
- color_t bg_color = colors.bar_bg;
+ color_t bg_color = bar_color;
int border_width = (block->border) ? logical_px(1) : 0;
int full_render_width = render->width + render->x_offset + render->x_append;
if (block->border || block->background || block->urgent) {
/* Let's determine the colors first. */
- color_t border_color = colors.bar_bg;
+ color_t border_color = bar_color;
if (block->urgent) {
border_color = colors.urgent_ws_border;
bg_color = colors.urgent_ws_bg;
/* If this is not the last block, draw a separator. */
if (TAILQ_NEXT(block, blocks) != NULL) {
x += block->sep_block_width;
- draw_separator(output, x, block);
+ draw_separator(output, x, block, use_focus_colors);
}
}
}
PARSE_COLOR_FALLBACK(binding_mode_fg, urgent_ws_fg);
PARSE_COLOR_FALLBACK(binding_mode_bg, urgent_ws_bg);
PARSE_COLOR_FALLBACK(binding_mode_border, urgent_ws_border);
+
+ /* Similarly, for unspecified focused bar colors, we fall back to the
+ * regular bar colors. */
+ PARSE_COLOR_FALLBACK(focus_bar_fg, bar_fg);
+ PARSE_COLOR_FALLBACK(focus_bar_bg, bar_bg);
+ PARSE_COLOR_FALLBACK(focus_sep_fg, sep_fg);
#undef PARSE_COLOR_FALLBACK
init_tray_colors();
reconfig_windows(false);
}
+ bool use_focus_colors = output_has_focus(outputs_walk);
+
/* First things first: clear the backbuffer */
- draw_util_clear_surface(&(outputs_walk->buffer), colors.bar_bg);
+ draw_util_clear_surface(&(outputs_walk->buffer),
+ (use_focus_colors ? colors.focus_bar_bg : colors.bar_bg));
if (!config.disable_ws) {
i3_ws *ws_walk;
int16_t visible_statusline_width = MIN(statusline_width, max_statusline_width);
int x_dest = outputs_walk->rect.w - tray_width - logical_px(sb_hoff_px) - visible_statusline_width;
- draw_statusline(outputs_walk, clip_left, use_short_text);
+ draw_statusline(outputs_walk, clip_left, use_focus_colors, use_short_text);
draw_util_copy_surface(&outputs_walk->statusline_buffer, &outputs_walk->buffer, 0, 0,
x_dest, 0, visible_statusline_width, (int16_t)bar_height);