mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 06:24:20 +01:00
cmd_move: fix move to scratchpad hidden container
When moving to a scratchpad hidden container (using `move [window|container] [to] mark <mark>`), this moves the container to the scratchpad (equivalent to `move [window|container] [to] scratchpad`). Previously, this would crash since the destination did not have a workspace.
This commit is contained in:
parent
a074e0f504
commit
90bef0364b
@ -388,6 +388,8 @@ static bool container_move_in_direction(struct sway_container *container,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct cmd_results *cmd_move_to_scratchpad(void);
|
||||||
|
|
||||||
static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
||||||
int argc, char **argv) {
|
int argc, char **argv) {
|
||||||
struct cmd_results *error = NULL;
|
struct cmd_results *error = NULL;
|
||||||
@ -505,6 +507,11 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
|||||||
return cmd_results_new(CMD_INVALID, expected_syntax);
|
return cmd_results_new(CMD_INVALID, expected_syntax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (destination->type == N_CONTAINER &&
|
||||||
|
container_is_scratchpad_hidden(destination->sway_container)) {
|
||||||
|
return cmd_move_to_scratchpad();
|
||||||
|
}
|
||||||
|
|
||||||
if (container->is_sticky && container_is_floating_or_child(container) &&
|
if (container->is_sticky && container_is_floating_or_child(container) &&
|
||||||
old_output && node_has_ancestor(destination, &old_output->node)) {
|
old_output && node_has_ancestor(destination, &old_output->node)) {
|
||||||
return cmd_results_new(CMD_FAILURE, "Can't move sticky "
|
return cmd_results_new(CMD_FAILURE, "Can't move sticky "
|
||||||
|
Loading…
Reference in New Issue
Block a user