aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/bind.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/commands/bind.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/commands/bind.c')
-rw-r--r--sway/commands/bind.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 08acbe7a..34881b0f 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -289,13 +289,20 @@ void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding)
289 wlr_log(WLR_DEBUG, "running command for binding: %s", binding->command); 289 wlr_log(WLR_DEBUG, "running command for binding: %s", binding->command);
290 290
291 config->handler_context.seat = seat; 291 config->handler_context.seat = seat;
292 struct cmd_results *results = execute_command(binding->command, NULL, NULL); 292 list_t *res_list = execute_command(binding->command, NULL, NULL);
293 if (results->status == CMD_SUCCESS) { 293 bool success = true;
294 while (res_list->length) {
295 struct cmd_results *results = res_list->items[0];
296 if (results->status != CMD_SUCCESS) {
297 wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
298 binding->command, results->error);
299 success = false;
300 }
301 free_cmd_results(results);
302 list_del(res_list, 0);
303 }
304 list_free(res_list);
305 if (success) {
294 ipc_event_binding(binding); 306 ipc_event_binding(binding);
295 } else {
296 wlr_log(WLR_DEBUG, "could not run command for binding: %s (%s)",
297 binding->command, results->error);
298 } 307 }
299
300 free_cmd_results(results);
301} 308}