diff options
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r-- | swaybar/bar.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index 53e798bc..c26e76ce 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -18,6 +18,9 @@ | |||
18 | #include "swaybar/ipc.h" | 18 | #include "swaybar/ipc.h" |
19 | #include "swaybar/status_line.h" | 19 | #include "swaybar/status_line.h" |
20 | #include "swaybar/render.h" | 20 | #include "swaybar/render.h" |
21 | #if HAVE_TRAY | ||
22 | #include "swaybar/tray/tray.h" | ||
23 | #endif | ||
21 | #include "ipc-client.h" | 24 | #include "ipc-client.h" |
22 | #include "list.h" | 25 | #include "list.h" |
23 | #include "log.h" | 26 | #include "log.h" |
@@ -362,6 +365,10 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) { | |||
362 | pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); | 365 | pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); |
363 | assert(pointer->cursor_surface); | 366 | assert(pointer->cursor_surface); |
364 | 367 | ||
368 | #if HAVE_TRAY | ||
369 | bar->tray = create_tray(bar); | ||
370 | #endif | ||
371 | |||
365 | if (bar->config->workspace_buttons) { | 372 | if (bar->config->workspace_buttons) { |
366 | ipc_get_workspaces(bar); | 373 | ipc_get_workspaces(bar); |
367 | } | 374 | } |
@@ -403,6 +410,11 @@ void bar_run(struct swaybar *bar) { | |||
403 | loop_add_fd(bar->eventloop, bar->status->read_fd, POLLIN, | 410 | loop_add_fd(bar->eventloop, bar->status->read_fd, POLLIN, |
404 | status_in, bar); | 411 | status_in, bar); |
405 | } | 412 | } |
413 | #if HAVE_TRAY | ||
414 | if (bar->tray) { | ||
415 | loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in, bar->tray->bus); | ||
416 | } | ||
417 | #endif | ||
406 | while (1) { | 418 | while (1) { |
407 | errno = 0; | 419 | errno = 0; |
408 | if (wl_display_flush(bar->display) == -1 && errno != EAGAIN) { | 420 | if (wl_display_flush(bar->display) == -1 && errno != EAGAIN) { |
@@ -420,6 +432,9 @@ static void free_outputs(struct wl_list *list) { | |||
420 | } | 432 | } |
421 | 433 | ||
422 | void bar_teardown(struct swaybar *bar) { | 434 | void bar_teardown(struct swaybar *bar) { |
435 | #if HAVE_TRAY | ||
436 | destroy_tray(bar->tray); | ||
437 | #endif | ||
423 | free_outputs(&bar->outputs); | 438 | free_outputs(&bar->outputs); |
424 | if (bar->config) { | 439 | if (bar->config) { |
425 | free_config(bar->config); | 440 | free_config(bar->config); |