aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 71f8dddd..b7cd2d76 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -343,6 +343,22 @@ void ipc_client_handle_command(struct ipc_client *client) {
343 goto exit_cleanup; 343 goto exit_cleanup;
344 } 344 }
345 345
346 case IPC_GET_OUTPUTS:
347 {
348 json_object *outputs = json_object_new_array();
349 for (int i = 0; i < root_container.children->length; ++i) {
350 swayc_t *container = root_container.children->items[i];
351 if (container->type == C_OUTPUT) {
352 json_object_array_add(outputs,
353 ipc_json_describe_container(container));
354 }
355 }
356 const char *json_string = json_object_to_json_string(outputs);
357 ipc_send_reply(client, json_string, (uint32_t) strlen(json_string));
358 json_object_put(outputs); // free
359 goto exit_cleanup;
360 }
361
346 case IPC_GET_TREE: 362 case IPC_GET_TREE:
347 { 363 {
348 json_object *tree = 364 json_object *tree =