diff options
author | Tarmack <[email protected]> | 2020-10-03 15:45:26 +0200 |
---|---|---|
committer | Simon Ser <[email protected]> | 2020-10-11 19:12:42 +0200 |
commit | 989123a2a5933367e5c7c39c3793f4814e026bf1 (patch) | |
tree | 8a13986177a3380b3d3c965ceb2526e6ceb9c88d /swaybar/render.c | |
parent | 657587964e5d8e444ac64829a0aab309c25ff50f (diff) |
Add support for workspace_min_width bar option.
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 3a626e1c..8f38174f 100644 --- a/swaybar/render.c +++ b/swaybar/render.c @@ -402,7 +402,11 @@ static uint32_t predict_workspace_button_length(cairo_t *cairo, return 0; } - return ws_horizontal_padding * 2 + text_width + border_width * 2; + uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2; + if (width < config->workspace_min_width * output->scale) { + width = config->workspace_min_width * output->scale; + } + return width; } static uint32_t predict_workspace_buttons_length(cairo_t *cairo, @@ -446,7 +450,11 @@ static uint32_t predict_binding_mode_indicator_length(cairo_t *cairo, output->height < ideal_surface_height) { return 0; } - return text_width + ws_horizontal_padding * 2 + border_width * 2; + uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2; + if (width < config->workspace_min_width * output->scale) { + width = config->workspace_min_width * output->scale; + } + return width; } static uint32_t render_status_line_i3bar(cairo_t *cairo, @@ -518,6 +526,9 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo, return ideal_surface_height; } uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2; + if (width < config->workspace_min_width * output->scale) { + width = config->workspace_min_width * output->scale; + } uint32_t height = output->height * output->scale; cairo_set_source_u32(cairo, config->colors.binding_mode.background); @@ -585,7 +596,10 @@ static uint32_t render_workspace_button(cairo_t *cairo, return ideal_surface_height; } - uint32_t width = ws_horizontal_padding * 2 + text_width + border_width * 2; + uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2; + if (width < config->workspace_min_width * output->scale) { + width = config->workspace_min_width * output->scale; + } cairo_set_source_u32(cairo, box_colors.background); cairo_rectangle(cairo, *x, 0, width, height); |