This commit is contained in:
Steve Williams 2026-01-29 15:40:59 -05:00 committed by GitHub
commit 8f55ce1433
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -303,12 +303,14 @@ list_t *execute_command(char *_exec, struct sway_seat *seat,
cmd_results_new(CMD_FAILURE, "No matching node."));
} else {
struct cmd_results *fail_res = NULL;
bool has_success = false;
for (int i = 0; i < containers->length; ++i) {
struct sway_container *container = containers->items[i];
set_config_node(&container->node, true);
struct cmd_results *res = handler->handle(argc-1, argv+1);
if (res->status == CMD_SUCCESS) {
free_cmd_results(res);
has_success = true;
} else {
// last failure will take precedence
if (fail_res) {
@ -322,6 +324,18 @@ list_t *execute_command(char *_exec, struct sway_seat *seat,
}
}
}
if(handler->handle == cmd_scratchpad) {
if (fail_res) {
free_cmd_results(fail_res);
fail_res = NULL;
}
if(!has_success) {
fail_res = cmd_results_new(CMD_INVALID, "Container is not in scratchpad.");
list_add(res_list, fail_res);
free_argv(argc, argv);
goto cleanup;
}
}
list_add(res_list,
fail_res ? fail_res : cmd_results_new(CMD_SUCCESS, NULL));
}

View file

@ -121,7 +121,7 @@ struct cmd_results *cmd_scratchpad(int argc, char **argv) {
// we'll return an error. The same is true if the
// overridden node is not a container.
if (!con || !con->scratchpad) {
return cmd_results_new(CMD_INVALID, "Container is not in scratchpad.");
return cmd_results_new(CMD_FAILURE, NULL);
}
scratchpad_toggle_container(con);
} else {