]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/src/ipc.c
Merge branch 'fix-split-indicator'
[i3/i3] / i3bar / src / ipc.c
index cfbc404e2016477720ecd419178624976338349c..2cc80cf7fac320cdf60af546e94331c6abe56d92 100644 (file)
@@ -2,12 +2,9 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3bar - an xcb-based status- and ws-bar for i3
+ * © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
  *
- * © 2010-2011 Axel Wagner and contributors
- *
- * See file LICNSE for license information
- *
- * src/ipc.c: Communicating with i3
+ * ipc.c: Communicating with i3
  *
  */
 #include <stdlib.h>
@@ -68,6 +65,13 @@ void got_output_reply(char *reply) {
     DLOG("Reconfiguring Windows...\n");
     realloc_sl_buffer();
     reconfig_windows();
+
+    i3_output *o_walk;
+    SLIST_FOREACH(o_walk, outputs, slist) {
+        kick_tray_clients(o_walk);
+    }
+
+    draw_bars();
 }
 
 /*
@@ -165,6 +169,7 @@ void got_data(struct ev_loop *loop, ev_io *watcher, int events) {
             /* EOF received. Since i3 will restart i3bar instances as appropriate,
              * we exit here. */
             DLOG("EOF received, exiting...\n");
+            clean_xcb();
             exit(EXIT_SUCCESS);
         }
         rec += n;
@@ -271,21 +276,7 @@ int i3_send_msg(uint32_t type, const char *payload) {
  */
 int init_connection(const char *socket_path) {
     sock_path = socket_path;
-    int sockfd = socket(AF_LOCAL, SOCK_STREAM, 0);
-    if (sockfd == -1) {
-        ELOG("Could not create Socket: %s\n", strerror(errno));
-        exit(EXIT_FAILURE);
-    }
-
-    struct sockaddr_un addr;
-    memset(&addr, 0, sizeof(struct sockaddr_un));
-    addr.sun_family = AF_LOCAL;
-    strcpy(addr.sun_path, sock_path);
-    if (connect(sockfd, (const struct sockaddr*) &addr, sizeof(struct sockaddr_un)) < 0) {
-        ELOG("Could not connect to i3! %s: %s\n", sock_path, strerror(errno));
-        exit(EXIT_FAILURE);
-    }
-
+    int sockfd = ipc_connect(socket_path);
     i3_connection = smalloc(sizeof(ev_io));
     ev_io_init(i3_connection, &got_data, sockfd, EV_READ);
     ev_io_start(main_loop, i3_connection);
@@ -295,7 +286,7 @@ int init_connection(const char *socket_path) {
 /*
  * Destroy the connection to i3.
  */
-void destroy_connection() {
+void destroy_connection(void) {
     close(i3_connection->fd);
     ev_io_stop(main_loop, i3_connection);
 }
@@ -304,7 +295,7 @@ void destroy_connection() {
  * Subscribe to all the i3-events, we need
  *
  */
-void subscribe_events() {
+void subscribe_events(void) {
     if (config.disable_ws) {
         i3_send_msg(I3_IPC_MESSAGE_TYPE_SUBSCRIBE, "[ \"output\" ]");
     } else {