char msg[buffer_size];
char *walk = msg;
- strcpy(walk, "i3-ipc");
+ strncpy(walk, "i3-ipc", buffer_size - 1);
walk += strlen("i3-ipc");
memcpy(walk, &message_size, sizeof(uint32_t));
walk += sizeof(uint32_t);
strncpy(command, (const char*)message, message_size);
LOG("IPC: received: *%s*\n", command);
const char *reply = parse_cmd((const char*)command);
- tree_render();
free(command);
/* If no reply was provided, we just use the default success message */
}
ystr("percent");
- y(double, con->percent);
+ if (con->percent == 0.0)
+ y(null);
+ else y(double, con->percent);
ystr("urgent");
- y(integer, con->urgent);
+ y(bool, con->urgent);
ystr("focused");
- y(integer, (con == focused));
+ y(bool, (con == focused));
ystr("layout");
- y(integer, con->layout);
+ switch (con->layout) {
+ case L_DEFAULT:
+ ystr("default");
+ break;
+ case L_STACKED:
+ ystr("stacked");
+ break;
+ case L_TABBED:
+ ystr("tabbed");
+ break;
+ case L_DOCKAREA:
+ ystr("dockarea");
+ break;
+ case L_OUTPUT:
+ ystr("output");
+ break;
+ }
ystr("border");
switch (con->border_style) {
ystr("current_workspace");
Con *ws = NULL;
- if (output->con && (ws = con_get_fullscreen_con(output->con)))
+ if (output->con && (ws = con_get_fullscreen_con(output->con, CF_OUTPUT)))
ystr(ws->name);
else y(null);