aboutsummaryrefslogtreecommitdiff
path: root/swaybar/render.c
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2017-06-14 18:53:40 -0400
committerGitHub <noreply@github.com>2017-06-14 18:53:40 -0400
commit298f56353ef155f6a2ccc977c96b2ff5d971e65e (patch)
treedcb3b74f1dde93bce8657b7509662ffd7db667d0 /swaybar/render.c
parenta5c07dde6aba87584ddb6c6a2769472a6003623a (diff)
parenteb6e38c86d2deb37cc6f378f8644c4a530fd7448 (diff)
Merge branch 'master' into server-decoration
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 @@
#include "swaybar/config.h"
#include "swaybar/status_line.h"
#include "swaybar/render.h"
+#ifdef ENABLE_TRAY
+#include "swaybar/tray/tray.h"
+#include "swaybar/tray/sni.h"
+#endif
#include "log.h"
@@ -297,6 +301,12 @@ void render(struct output *output, struct config *config, struct status_line *li
}
cairo_paint(cairo);
+#ifdef ENABLE_TRAY
+ uint32_t tray_width = tray_render(output, config);
+#else
+ const uint32_t tray_width = window->width * window->scale;
+#endif
+
// Command output
if (is_focused) {
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
if (line->protocol == TEXT) {
get_text_size(window->cairo, window->font, &width, &height,
window->scale, config->pango_markup, "%s", line->text_line);
- cairo_move_to(cairo, (window->width * window->scale)
- - margin - width, margin);
+ cairo_move_to(cairo, tray_width - margin - width, margin);
pango_printf(window->cairo, window->font, window->scale,
config->pango_markup, "%s", line->text_line);
} else if (line->protocol == I3BAR && line->block_line) {
- double pos = (window->width * window->scale) - 0.5;
+ double pos = tray_width - 0.5;
bool edge = true;
for (i = line->block_line->length - 1; i >= 0; --i) {
struct status_block *block = line->block_line->items[i];