From 5f65f339896fadf0011b75d78c869594876d35d9 Mon Sep 17 00:00:00 2001 From: Ian Fan Date: Sun, 28 Oct 2018 10:25:47 +0000 Subject: swaybar: add tray interface --- swaybar/bar.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'swaybar/bar.c') 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 @@ #include "swaybar/ipc.h" #include "swaybar/status_line.h" #include "swaybar/render.h" +#if HAVE_TRAY +#include "swaybar/tray/tray.h" +#endif #include "ipc-client.h" #include "list.h" #include "log.h" @@ -362,6 +365,10 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) { pointer->cursor_surface = wl_compositor_create_surface(bar->compositor); assert(pointer->cursor_surface); +#if HAVE_TRAY + bar->tray = create_tray(bar); +#endif + if (bar->config->workspace_buttons) { ipc_get_workspaces(bar); } @@ -403,6 +410,11 @@ void bar_run(struct swaybar *bar) { loop_add_fd(bar->eventloop, bar->status->read_fd, POLLIN, status_in, bar); } +#if HAVE_TRAY + if (bar->tray) { + loop_add_fd(bar->eventloop, bar->tray->fd, POLLIN, tray_in, bar->tray->bus); + } +#endif while (1) { errno = 0; if (wl_display_flush(bar->display) == -1 && errno != EAGAIN) { @@ -420,6 +432,9 @@ static void free_outputs(struct wl_list *list) { } void bar_teardown(struct swaybar *bar) { +#if HAVE_TRAY + destroy_tray(bar->tray); +#endif free_outputs(&bar->outputs); if (bar->config) { free_config(bar->config); -- cgit v1.2.3-70-g09d2