feat: added support for user-defined border widths in i3bar blocks (#3726)
This change introduces support for four new properties on the i3bar protocol, namely "border_top", "border_right", "border_bottom" and "border_left". If a block is drawn with a border, these values define the width of the corresponding edge in pixels. They all default to 1 if not specified to preserve compatibility. fixes #3722
This commit is contained in:
committed by
Michael Stapelberg
parent
48af067dfe
commit
ca82f95812
@ -176,6 +176,12 @@ static int stdin_start_map(void *context) {
|
||||
else
|
||||
ctx->block.sep_block_width = logical_px(8) + separator_symbol_width;
|
||||
|
||||
/* By default we draw all four borders if a border is set. */
|
||||
ctx->block.border_top = 1;
|
||||
ctx->block.border_right = 1;
|
||||
ctx->block.border_bottom = 1;
|
||||
ctx->block.border_left = 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -262,6 +268,22 @@ static int stdin_integer(void *context, long long val) {
|
||||
ctx->block.sep_block_width = (uint32_t)val;
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(ctx->last_map_key, "border_top") == 0) {
|
||||
ctx->block.border_top = (uint32_t)val;
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(ctx->last_map_key, "border_right") == 0) {
|
||||
ctx->block.border_right = (uint32_t)val;
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(ctx->last_map_key, "border_bottom") == 0) {
|
||||
ctx->block.border_bottom = (uint32_t)val;
|
||||
return 1;
|
||||
}
|
||||
if (strcasecmp(ctx->last_map_key, "border_left") == 0) {
|
||||
ctx->block.border_left = (uint32_t)val;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user