Separator color via config; separator width and on/off via ipc

This patch adds the following features:
1) Configure a color of the separator via config.  It is done like
   bar {
      colors {
         separator #000000
      }
   }
2) A block can have an integer entry "separator_block_width" which
   sets the width of the gap which would follow after the current block.

3) A block can have a boolean entry "separator" and if it is set
   to false, then the drawing of the separating line would be disabled.
This commit is contained in:
Artem Shinkarov
2013-01-27 20:27:21 +00:00
committed by Michael Stapelberg
parent a52b1b4bb0
commit 5f05ca6b5d
12 changed files with 47 additions and 6 deletions

View File

@ -98,6 +98,10 @@ static int stdin_start_array(void *context) {
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;
}
@ -117,6 +121,9 @@ static int stdin_boolean(void *context, int val) {
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;
}
@ -153,6 +160,9 @@ static int stdin_integer(void *context, long val) {
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;
}