Wire up basic IPC support

This commit is contained in:
Drew DeVault 2018-03-28 23:56:02 -04:00
parent cab1352801
commit 5c9ad035db
7 changed files with 225 additions and 25 deletions

View file

@ -14,6 +14,8 @@
#include "swaybar/config.h"
#include "swaybar/event_loop.h"
#include "swaybar/bar.h"
#include "swaybar/ipc.h"
#include "ipc-client.h"
#include "list.h"
#include "pango.h"
#include "pool-buffer.h"
@ -92,6 +94,10 @@ void bar_setup(struct swaybar *bar,
bar_init(bar);
init_event_loop();
bar->ipc_socketfd = ipc_open_socket(socket_path);
bar->ipc_event_socketfd = ipc_open_socket(socket_path);
ipc_get_config(bar, bar_id);
assert(bar->display = wl_display_connect(NULL));
struct wl_registry *registry = wl_display_get_registry(bar->display);
@ -122,6 +128,11 @@ static void display_in(int fd, short mask, void *_bar) {
}
}
static void ipc_in(int fd, short mask, void *_bar) {
struct swaybar *bar = (struct swaybar *)_bar;
handle_ipc_event(bar);
}
void bar_run(struct swaybar *bar) {
add_event(wl_display_get_fd(bar->display), POLLIN, display_in, bar);
while (1) {