diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-08-20 00:13:51 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-08-27 09:37:10 +0900 |
commit | c1ad1de1550e528c7d94cb11dbadea69c619420d (patch) | |
tree | 11293fd3d5f1be8607a16e774cb62dbc49e70a77 | |
parent | 26442ad8437d8247a651bd53ead6170660908aa7 (diff) |
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.
-rw-r--r-- | sway/commands/move.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c index 99215ffc3..6ad1c7ca0 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c @@ -388,6 +388,8 @@ static bool container_move_in_direction(struct sway_container *container, return false; } +static struct cmd_results *cmd_move_to_scratchpad(void); + static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth, int argc, char **argv) { 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); } + 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) && old_output && node_has_ancestor(destination, &old_output->node)) { return cmd_results_new(CMD_FAILURE, "Can't move sticky " |