diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-10 23:43:45 -0500 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-01-11 00:07:58 -0500 |
commit | c0f92cb2fb94ac87396da99646f9219e54b36860 (patch) | |
tree | b03bd387cc1226031230ad5503dcbf7025128e02 /swaybar/render.c | |
parent | 33d9de88efa7642e20b37493ff60ad0e9689ea47 (diff) |
swaybar: add status_padding command
Adds the bar subcommand `status_padding <padding>` which allows setting
the padding used for swaybar. If `status_padding` is set to `0`, blocks
will be able to take up the full height of the bar.
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 7cbcea07..edc97e77 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -35,7 +35,8 @@ static uint32_t render_status_line_error(cairo_t *cairo, cairo_set_source_u32(cairo, 0xFF0000FF); int margin = 3 * output->scale; - int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; + double ws_vertical_padding = + output->bar->config->status_padding * output->scale; char *font = output->bar->config->font; int text_width, text_height; @@ -71,7 +72,7 @@ static uint32_t render_status_line_text(cairo_t *cairo, get_text_size(cairo, config->font, &text_width, &text_height, NULL, output->scale, config->pango_markup, "%s", text); - int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; + double ws_vertical_padding = config->status_padding * output->scale; int margin = 3 * output->scale; uint32_t ideal_height = text_height + ws_vertical_padding * 2; @@ -153,7 +154,7 @@ static uint32_t render_status_block(cairo_t *cairo, output->scale, block->markup, "%s", block->full_text); int margin = 3 * output->scale; - double ws_vertical_padding = WS_VERTICAL_PADDING * 2 * output->scale; + double ws_vertical_padding = config->status_padding * output->scale; int width = text_width; if (width < block->min_width) { @@ -212,8 +213,8 @@ static uint32_t render_status_block(cairo_t *cairo, } double x_pos = *x; - double y_pos = WS_VERTICAL_PADDING * output->scale; - double render_height = height - ws_vertical_padding + output->scale; + double y_pos = ws_vertical_padding; + double render_height = height - ws_vertical_padding * 2; uint32_t bg_color = block->urgent ? config->colors.urgent_workspace.background : block->background; |