From c0f92cb2fb94ac87396da99646f9219e54b36860 Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Thu, 10 Jan 2019 23:43:45 -0500 Subject: swaybar: add status_padding command Adds the bar subcommand `status_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. --- swaybar/render.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'swaybar/render.c') 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; -- cgit v1.2.3