diff options
Diffstat (limited to 'swaybar/render.c')
-rw-r--r-- | swaybar/render.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/swaybar/render.c b/swaybar/render.c index 2a06a79b..d226ba32 100644 --- a/swaybar/render.c +++ b/swaybar/render.c | |||
@@ -296,11 +296,15 @@ static uint32_t render_status_line(cairo_t *cairo, | |||
296 | 296 | ||
297 | static uint32_t render_binding_mode_indicator(cairo_t *cairo, | 297 | static uint32_t render_binding_mode_indicator(cairo_t *cairo, |
298 | struct swaybar_output *output, double x) { | 298 | struct swaybar_output *output, double x) { |
299 | const char *mode = output->bar->mode; | ||
300 | if (!mode) { | ||
301 | return 0; | ||
302 | } | ||
303 | |||
299 | struct swaybar_config *config = output->bar->config; | 304 | struct swaybar_config *config = output->bar->config; |
300 | const char *mode = config->mode; | ||
301 | int text_width, text_height; | 305 | int text_width, text_height; |
302 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, | 306 | get_text_size(cairo, config->font, &text_width, &text_height, NULL, |
303 | output->scale, config->mode_pango_markup, | 307 | output->scale, output->bar->mode_pango_markup, |
304 | "%s", mode); | 308 | "%s", mode); |
305 | 309 | ||
306 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; | 310 | int ws_vertical_padding = WS_VERTICAL_PADDING * output->scale; |
@@ -333,8 +337,8 @@ static uint32_t render_binding_mode_indicator(cairo_t *cairo, | |||
333 | double text_y = height / 2.0 - text_height / 2.0; | 337 | double text_y = height / 2.0 - text_height / 2.0; |
334 | cairo_set_source_u32(cairo, config->colors.binding_mode.text); | 338 | cairo_set_source_u32(cairo, config->colors.binding_mode.text); |
335 | cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y)); | 339 | cairo_move_to(cairo, x + width / 2 - text_width / 2, (int)floor(text_y)); |
336 | pango_printf(cairo, config->font, output->scale, config->mode_pango_markup, | 340 | pango_printf(cairo, config->font, output->scale, |
337 | "%s", mode); | 341 | output->bar->mode_pango_markup, "%s", mode); |
338 | return output->height; | 342 | return output->height; |
339 | } | 343 | } |
340 | 344 | ||
@@ -465,7 +469,7 @@ static uint32_t render_to_cairo(cairo_t *cairo, struct swaybar_output *output) { | |||
465 | max_height = h > max_height ? h : max_height; | 469 | max_height = h > max_height ? h : max_height; |
466 | } | 470 | } |
467 | } | 471 | } |
468 | if (config->binding_mode_indicator && config->mode) { | 472 | if (config->binding_mode_indicator) { |
469 | uint32_t h = render_binding_mode_indicator(cairo, output, x); | 473 | uint32_t h = render_binding_mode_indicator(cairo, output, x); |
470 | max_height = h > max_height ? h : max_height; | 474 | max_height = h > max_height ? h : max_height; |
471 | } | 475 | } |