aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/move.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-08-20 00:13:51 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-08-23 09:12:06 +0900
commit90bef0364b349f97f1568bf8e4075184e8748c43 (patch)
treee23d799687b9a861423729ee418055004e1b1b59 /sway/commands/move.c
parentipc: collapse multi-container command results (diff)
downloadsway-90bef0364b349f97f1568bf8e4075184e8748c43.tar.gz
sway-90bef0364b349f97f1568bf8e4075184e8748c43.tar.zst
sway-90bef0364b349f97f1568bf8e4075184e8748c43.zip
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.
Diffstat (limited to 'sway/commands/move.c')
-rw-r--r--sway/commands/move.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 99215ffc..6ad1c7ca 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,
388 return false; 388 return false;
389} 389}
390 390
391static struct cmd_results *cmd_move_to_scratchpad(void);
392
391static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth, 393static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
392 int argc, char **argv) { 394 int argc, char **argv) {
393 struct cmd_results *error = NULL; 395 struct cmd_results *error = NULL;
@@ -505,6 +507,11 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
505 return cmd_results_new(CMD_INVALID, expected_syntax); 507 return cmd_results_new(CMD_INVALID, expected_syntax);
506 } 508 }
507 509
510 if (destination->type == N_CONTAINER &&
511 container_is_scratchpad_hidden(destination->sway_container)) {
512 return cmd_move_to_scratchpad();
513 }
514
508 if (container->is_sticky && container_is_floating_or_child(container) && 515 if (container->is_sticky && container_is_floating_or_child(container) &&
509 old_output && node_has_ancestor(destination, &old_output->node)) { 516 old_output && node_has_ancestor(destination, &old_output->node)) {
510 return cmd_results_new(CMD_FAILURE, "Can't move sticky " 517 return cmd_results_new(CMD_FAILURE, "Can't move sticky "