mirror of
https://github.com/swaywm/sway.git
synced 2026-02-05 04:06:25 -05:00
Merge 26a050eac6 into e3c2412565
This commit is contained in:
commit
8f55ce1433
2 changed files with 15 additions and 1 deletions
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue