diff options
author | Drew DeVault <[email protected]> | 2018-03-28 23:56:02 -0400 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2018-03-29 22:11:08 -0400 |
commit | 5c9ad035db1bebba3f1954dd1f4328c6421776d4 (patch) | |
tree | 860eef96eaa4e7573384e64731f914d24e846cf5 /swaybar/bar.c | |
parent | cab1352801b62d1b8a12ca1c995cb24445ce4bc9 (diff) |
Wire up basic IPC support
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r-- | swaybar/bar.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index e1d594b4..433e2948 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c @@ -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) { |