From: Axel Wagner Date: Sun, 31 Jul 2011 16:26:52 +0000 (+0200) Subject: Bugfix: Delay event-subscription until reconnect (thx aniou) X-Git-Tag: 4.0.1~7^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3302b22f71d3d77b4183ab261e712ca2fee6268e;p=i3%2Fi3 Bugfix: Delay event-subscription until reconnect (thx aniou) --- diff --git a/i3bar/src/ipc.c b/i3bar/src/ipc.c index 3d2cca58..85cd234f 100644 --- a/i3bar/src/ipc.c +++ b/i3bar/src/ipc.c @@ -44,7 +44,13 @@ void retry_connection(struct ev_loop *loop, ev_timer *w, int events) { retries = 8; ev_timer_stop(loop, w); subscribe_events(); - reconfig_windows(); + + /* We get the current outputs and workspaces, to + * reconfigure all bars with the current configuration */ + i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL); + if (!config.disable_ws) { + i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL); + } } /* diff --git a/i3bar/src/main.c b/i3bar/src/main.c index d3107bfb..e91511ef 100644 --- a/i3bar/src/main.c +++ b/i3bar/src/main.c @@ -260,17 +260,17 @@ int main(int argc, char **argv) { free_colors(&colors); init_outputs(); - init_connection(socket_path); - - /* We subscribe to the i3-events we need */ - subscribe_events(); - - /* We initiate the main-function by requesting infos about the outputs and - * workspaces. Everything else (creating the bars, showing the right workspace- - * buttons and more) is taken care of by the event-driveniness of the code */ - i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL); - if (!config.disable_ws) { - i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL); + if (init_connection(socket_path)) { + /* We subscribe to the i3-events we need */ + subscribe_events(); + + /* We initiate the main-function by requesting infos about the outputs and + * workspaces. Everything else (creating the bars, showing the right workspace- + * buttons and more) is taken care of by the event-driveniness of the code */ + i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_OUTPUTS, NULL); + if (!config.disable_ws) { + i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_WORKSPACES, NULL); + } } /* The name of this function is actually misleading. Even if no -c is specified,