aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorLibravatar Tarmack <git@tarmack.eu>2020-10-03 15:45:26 +0200
committerLibravatar Simon Ser <contact@emersion.fr>2020-10-11 19:12:42 +0200
commit989123a2a5933367e5c7c39c3793f4814e026bf1 (patch)
tree8a13986177a3380b3d3c965ceb2526e6ceb9c88d /swaybar/render.c
parentxwayland: support views that change override-redirect status (diff)
downloadsway-989123a2a5933367e5c7c39c3793f4814e026bf1.tar.gz
sway-989123a2a5933367e5c7c39c3793f4814e026bf1.tar.zst
sway-989123a2a5933367e5c7c39c3793f4814e026bf1.zip
Add support for workspace_min_width bar option.
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c20
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,
402 return 0; 402 return 0;
403 } 403 }
404 404
405 return ws_horizontal_padding * 2 + text_width + border_width * 2; 405 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2;
406 if (width < config->workspace_min_width * output->scale) {
407 width = config->workspace_min_width * output->scale;
408 }
409 return width;
406} 410}
407 411
408static uint32_t predict_workspace_buttons_length(cairo_t *cairo, 412static uint32_t predict_workspace_buttons_length(cairo_t *cairo,
@@ -446,7 +450,11 @@ static uint32_t predict_binding_mode_indicator_length(cairo_t *cairo,
446 output->height < ideal_surface_height) { 450 output->height < ideal_surface_height) {
447 return 0; 451 return 0;
448 } 452 }
449 return text_width + ws_horizontal_padding * 2 + border_width * 2; 453 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2;
454 if (width < config->workspace_min_width * output->scale) {
455 width = config->workspace_min_width * output->scale;
456 }
457 return width;
450} 458}
451 459
452static uint32_t render_status_line_i3bar(cairo_t *cairo, 460static uint32_t render_status_line_i3bar(cairo_t *cairo,
@@ -518,6 +526,9 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo,
518 return ideal_surface_height; 526 return ideal_surface_height;
519 } 527 }
520 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2; 528 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2;
529 if (width < config->workspace_min_width * output->scale) {
530 width = config->workspace_min_width * output->scale;
531 }
521 532
522 uint32_t height = output->height * output->scale; 533 uint32_t height = output->height * output->scale;
523 cairo_set_source_u32(cairo, config->colors.binding_mode.background); 534 cairo_set_source_u32(cairo, config->colors.binding_mode.background);
@@ -585,7 +596,10 @@ static uint32_t render_workspace_button(cairo_t *cairo,
585 return ideal_surface_height; 596 return ideal_surface_height;
586 } 597 }
587 598
588 uint32_t width = ws_horizontal_padding * 2 + text_width + border_width * 2; 599 uint32_t width = text_width + ws_horizontal_padding * 2 + border_width * 2;
600 if (width < config->workspace_min_width * output->scale) {
601 width = config->workspace_min_width * output->scale;
602 }
589 603
590 cairo_set_source_u32(cairo, box_colors.background); 604 cairo_set_source_u32(cairo, box_colors.background);
591 cairo_rectangle(cairo, *x, 0, width, height); 605 cairo_rectangle(cairo, *x, 0, width, height);