summaryrefslogtreecommitdiffstats
path: root/swaybar/render.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaybar/render.c')
-rw-r--r--swaybar/render.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/swaybar/render.c b/swaybar/render.c
index 2eae997f..6ec47e79 100644
--- a/swaybar/render.c
+++ b/swaybar/render.c
@@ -8,6 +8,10 @@
8#include "swaybar/config.h" 8#include "swaybar/config.h"
9#include "swaybar/status_line.h" 9#include "swaybar/status_line.h"
10#include "swaybar/render.h" 10#include "swaybar/render.h"
11#ifdef ENABLE_TRAY
12#include "swaybar/tray/tray.h"
13#include "swaybar/tray/sni.h"
14#endif
11#include "log.h" 15#include "log.h"
12 16
13 17
@@ -297,6 +301,12 @@ void render(struct output *output, struct config *config, struct status_line *li
297 } 301 }
298 cairo_paint(cairo); 302 cairo_paint(cairo);
299 303
304#ifdef ENABLE_TRAY
305 uint32_t tray_width = tray_render(output, config);
306#else
307 const uint32_t tray_width = window->width * window->scale;
308#endif
309
300 // Command output 310 // Command output
301 if (is_focused) { 311 if (is_focused) {
302 cairo_set_source_u32(cairo, config->colors.focused_statusline); 312 cairo_set_source_u32(cairo, config->colors.focused_statusline);
@@ -309,12 +319,11 @@ void render(struct output *output, struct config *config, struct status_line *li
309 if (line->protocol == TEXT) { 319 if (line->protocol == TEXT) {
310 get_text_size(window->cairo, window->font, &width, &height, 320 get_text_size(window->cairo, window->font, &width, &height,
311 window->scale, config->pango_markup, "%s", line->text_line); 321 window->scale, config->pango_markup, "%s", line->text_line);
312 cairo_move_to(cairo, (window->width * window->scale) 322 cairo_move_to(cairo, tray_width - margin - width, margin);
313 - margin - width, margin);
314 pango_printf(window->cairo, window->font, window->scale, 323 pango_printf(window->cairo, window->font, window->scale,
315 config->pango_markup, "%s", line->text_line); 324 config->pango_markup, "%s", line->text_line);
316 } else if (line->protocol == I3BAR && line->block_line) { 325 } else if (line->protocol == I3BAR && line->block_line) {
317 double pos = (window->width * window->scale) - 0.5; 326 double pos = tray_width - 0.5;
318 bool edge = true; 327 bool edge = true;
319 for (i = line->block_line->length - 1; i >= 0; --i) { 328 for (i = line->block_line->length - 1; i >= 0; --i) {
320 struct status_block *block = line->block_line->items[i]; 329 struct status_block *block = line->block_line->items[i];