aboutsummaryrefslogtreecommitdiffstats
path: root/sway/ipc-server.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-11-27 21:42:09 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-11-27 21:42:09 -0500
commit5c6f3d7266ab0c63015715f12c8e15eb144311a2 (patch)
tree8a30abddb8380fc03d6f8674c469570fbf493327 /sway/ipc-server.c
parentMerge pull request #3175 from emersion/rename-gtk-primary-selection (diff)
downloadsway-5c6f3d7266ab0c63015715f12c8e15eb144311a2.tar.gz
sway-5c6f3d7266ab0c63015715f12c8e15eb144311a2.tar.zst
sway-5c6f3d7266ab0c63015715f12c8e15eb144311a2.zip
Change execute_command to return a list of results
This matches i3's behavior of returning a list of results that contain the result of each command that was executed. Additionally, the `parse_error` attribute has been added to the IPC JSON reply.
Diffstat (limited to 'sway/ipc-server.c')
-rw-r--r--sway/ipc-server.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index aa0f0fad..95433d97 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -597,13 +597,18 @@ void ipc_client_handle_command(struct ipc_client *client) {
597 switch (client->current_command) { 597 switch (client->current_command) {
598 case IPC_COMMAND: 598 case IPC_COMMAND:
599 { 599 {
600 struct cmd_results *results = execute_command(buf, NULL, NULL); 600 list_t *res_list = execute_command(buf, NULL, NULL);
601 transaction_commit_dirty(); 601 transaction_commit_dirty();
602 char *json = cmd_results_to_json(results); 602 char *json = cmd_results_to_json(res_list);
603 int length = strlen(json); 603 int length = strlen(json);
604 client_valid = ipc_send_reply(client, json, (uint32_t)length); 604 client_valid = ipc_send_reply(client, json, (uint32_t)length);
605 free(json); 605 free(json);
606 free_cmd_results(results); 606 while (res_list->length) {
607 struct cmd_results *results = res_list->items[0];
608 free_cmd_results(results);
609 list_del(res_list, 0);
610 }
611 list_free(res_list);
607 goto exit_cleanup; 612 goto exit_cleanup;
608 } 613 }
609 614