A boolean which specifies whether the current value is urgent. Examples
are battery charge values below 1 percent or no more available disk
space (for non-root users). The presentation of urgency is up to i3bar.
+separator::
+ The boolean value false disables drawing of a separating line after the
+ block. If the field is not present then the separator will be still
+ drawn. Keep in mind that absence of a separator is only responsible for
+ the line itself, the gap between the items would be still present.
+separator_block_width::
+ The integer value that sets the width of the gap between items in pixels.
+ In the middle of the gap, a separating line is going to be drawn.
If you want to put in your own entries into a block, prefix the key with an
underscore (_). i3bar will ignore all keys it doesn’t understand, and prefixing
Background color of the bar.
statusline::
Text color to be used for the statusline.
+separator::
+ Text color to be used for the separator.
focused_workspace_text/focused_workspace_bg::
Text color/background color for a workspace button when the workspace
has focus.
Background color of the bar.
statusline::
Text color to be used for the statusline.
+separator::
+ Text color to be used for the separator.
focused_workspace::
Border, background and text color for a workspace button when the workspace
has focus.
colors {
background <color>
statusline <color>
+ separator <color>
colorclass <border> <background> <text>
}
colors {
background #000000
statusline #ffffff
+ separator #666666
focused_workspace #4c7899 #285577 #ffffff
active_workspace #333333 #5f676a #ffffff
blockalign_t align;
bool urgent;
+ bool no_separator;
+
+ /* The amount of pixels necessary to render a separater after the block. */
+ uint32_t sep_block_width;
/* The amount of pixels necessary to render this block. These variables are
* only temporarily used in refresh_statusline(). */
struct xcb_color_strings_t {
char *bar_fg;
char *bar_bg;
+ char *sep_fg;
char *active_ws_fg;
char *active_ws_bg;
char *active_ws_border;
static int stdin_start_map(void *context) {
parser_ctx *ctx = context;
memset(&(ctx->block), '\0', sizeof(struct status_block));
+
+ /* Default width of the separator block. */
+ ctx->block.sep_block_width = 9;
+
return 1;
}
if (strcasecmp(ctx->last_map_key, "urgent") == 0) {
ctx->block.urgent = val;
}
+ if (strcasecmp(ctx->last_map_key, "separator") == 0) {
+ ctx->block.no_separator = !val;
+ }
return 1;
}
if (strcasecmp(ctx->last_map_key, "min_width") == 0) {
ctx->block.min_width = (uint32_t)val;
}
+ if (strcasecmp(ctx->last_map_key, "separator_block_width") == 0) {
+ ctx->block.sep_block_width = (uint32_t)val;
+ }
return 1;
}
COLOR(statusline, bar_fg);
COLOR(background, bar_bg);
+ COLOR(separator, sep_fg);
COLOR(focused_workspace_border, focus_ws_border);
COLOR(focused_workspace_bg, focus_ws_bg);
COLOR(focused_workspace_text, focus_ws_fg);
} while (0)
FREE_COLOR(bar_fg);
FREE_COLOR(bar_bg);
+ FREE_COLOR(sep_fg);
FREE_COLOR(active_ws_fg);
FREE_COLOR(active_ws_bg);
FREE_COLOR(active_ws_border);
struct xcb_colors_t {
uint32_t bar_fg;
uint32_t bar_bg;
+ uint32_t sep_fg;
uint32_t active_ws_fg;
uint32_t active_ws_bg;
uint32_t active_ws_border;
/* If this is not the last block, add some pixels for a separator. */
if (TAILQ_NEXT(block, blocks) != NULL)
- block->width += 9;
+ block->width += block->sep_block_width;
+
statusline_width += block->width + block->x_offset + block->x_append;
}
draw_text(block->full_text, statusline_pm, statusline_ctx, x + block->x_offset, 1, block->width);
x += block->width + block->x_offset + block->x_append;
- if (TAILQ_NEXT(block, blocks) != NULL) {
+ if (TAILQ_NEXT(block, blocks) != NULL && !block->no_separator && block->sep_block_width > 0) {
/* This is not the last block, draw a separator. */
- set_font_colors(statusline_ctx, get_colorpixel("#666666"), colors.bar_bg);
+ uint32_t sep_offset = block->sep_block_width/2 + block->sep_block_width % 2;
+ set_font_colors(statusline_ctx, colors.sep_fg, colors.bar_bg);
xcb_poly_line(xcb_connection, XCB_COORD_MODE_ORIGIN, statusline_pm,
statusline_ctx, 2,
- (xcb_point_t[]){ { x - 5, 2 }, { x - 5, font.height - 2 } });
+ (xcb_point_t[]){ { x - sep_offset, 2 },
+ { x - sep_offset, font.height - 2 } });
}
}
}
} while (0)
PARSE_COLOR(bar_fg, "#FFFFFF");
PARSE_COLOR(bar_bg, "#000000");
+ PARSE_COLOR(sep_fg, "#666666");
PARSE_COLOR(active_ws_fg, "#FFFFFF");
PARSE_COLOR(active_ws_bg, "#333333");
PARSE_COLOR(active_ws_border, "#333333");
struct bar_colors {
char *background;
char *statusline;
+ char *separator;
char *focused_workspace_border;
char *focused_workspace_bg;
end ->
'#' -> BAR_COLORS_IGNORE_LINE
'set' -> BAR_COLORS_IGNORE_LINE
- colorclass = 'background', 'statusline'
+ colorclass = 'background', 'statusline', 'separator'
-> BAR_COLORS_SINGLE
colorclass = 'focused_workspace', 'active_workspace', 'inactive_workspace', 'urgent_workspace'
-> BAR_COLORS_BORDER
CFGFUN(bar_color_single, const char *colorclass, const char *color) {
if (strcmp(colorclass, "background") == 0)
current_bar.colors.background = sstrdup(color);
- else current_bar.colors.statusline = sstrdup(color);
+ else if (strcmp(colorclass, "separator") == 0)
+ current_bar.colors.separator = sstrdup(color);
+ else
+ current_bar.colors.statusline = sstrdup(color);
}
CFGFUN(bar_status_command, const char *command) {
y(map_open);
YSTR_IF_SET(background);
YSTR_IF_SET(statusline);
+ YSTR_IF_SET(separator);
YSTR_IF_SET(focused_workspace_border);
YSTR_IF_SET(focused_workspace_bg);
YSTR_IF_SET(focused_workspace_text);