diff options
author | emersion <contact@emersion.fr> | 2017-12-18 14:06:03 +0100 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2017-12-18 14:06:03 +0100 |
commit | 4e2ab531195f97370f417c6852a05be99eec2876 (patch) | |
tree | 85979d4c2b75698b919176884a35a1f129a92e7f /sway/ipc-server.c | |
parent | Merge pull request #1503 from emersion/output-config (diff) | |
download | sway-4e2ab531195f97370f417c6852a05be99eec2876.tar.gz sway-4e2ab531195f97370f417c6852a05be99eec2876.tar.zst sway-4e2ab531195f97370f417c6852a05be99eec2876.zip |
Add IPC get_outputs
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r-- | sway/ipc-server.c | 16 |
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 = |