diff options
-rw-r--r-- | sway/commands/floating.c | 5 | ||||
-rw-r--r-- | sway/commands/move.c | 9 | ||||
-rw-r--r-- | sway/commands/resize.c | 5 | ||||
-rw-r--r-- | sway/commands/split.c | 4 | ||||
-rw-r--r-- | sway/commands/sticky.c | 3 | ||||
-rw-r--r-- | sway/tree/root.c | 3 |
6 files changed, 28 insertions, 1 deletions
diff --git a/sway/commands/floating.c b/sway/commands/floating.c index e95f3185..57bf0017 100644 --- a/sway/commands/floating.c +++ b/sway/commands/floating.c | |||
@@ -40,6 +40,11 @@ struct cmd_results *cmd_floating(int argc, char **argv) { | |||
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | if (container->scratchpad && !container->workspace) { | ||
44 | return cmd_results_new(CMD_FAILURE, | ||
45 | "Cannot set floating status on a hidden scratchpad container"); | ||
46 | } | ||
47 | |||
43 | bool wants_floating = | 48 | bool wants_floating = |
44 | parse_boolean(argv[0], container_is_floating(container)); | 49 | parse_boolean(argv[0], container_is_floating(container)); |
45 | 50 | ||
diff --git a/sway/commands/move.c b/sway/commands/move.c index d4fe2f01..d4b55922 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -653,6 +653,10 @@ static struct cmd_results *cmd_move_in_direction( | |||
653 | return cmd_results_new(CMD_FAILURE, | 653 | return cmd_results_new(CMD_FAILURE, |
654 | "Cannot move workspaces in a direction"); | 654 | "Cannot move workspaces in a direction"); |
655 | } | 655 | } |
656 | if (container->scratchpad && !container->workspace) { | ||
657 | return cmd_results_new(CMD_FAILURE, | ||
658 | "Cannot move a hidden scratchpad container"); | ||
659 | } | ||
656 | if (container_is_floating(container)) { | 660 | if (container_is_floating(container)) { |
657 | if (container->is_fullscreen) { | 661 | if (container->is_fullscreen) { |
658 | return cmd_results_new(CMD_FAILURE, | 662 | return cmd_results_new(CMD_FAILURE, |
@@ -720,6 +724,11 @@ static struct cmd_results *cmd_move_to_position(int argc, char **argv) { | |||
720 | return cmd_results_new(CMD_FAILURE, "Only floating containers " | 724 | return cmd_results_new(CMD_FAILURE, "Only floating containers " |
721 | "can be moved to an absolute position"); | 725 | "can be moved to an absolute position"); |
722 | } | 726 | } |
727 | if (container->scratchpad && !container->workspace) { | ||
728 | return cmd_results_new(CMD_FAILURE, | ||
729 | "Cannot move a hidden scratchpad container"); | ||
730 | } | ||
731 | |||
723 | if (!argc) { | 732 | if (!argc) { |
724 | return cmd_results_new(CMD_FAILURE, expected_position_syntax); | 733 | return cmd_results_new(CMD_FAILURE, expected_position_syntax); |
725 | } | 734 | } |
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index 6cdeb90c..d840f26c 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c | |||
@@ -589,6 +589,11 @@ struct cmd_results *cmd_resize(int argc, char **argv) { | |||
589 | if (!current) { | 589 | if (!current) { |
590 | return cmd_results_new(CMD_INVALID, "Cannot resize nothing"); | 590 | return cmd_results_new(CMD_INVALID, "Cannot resize nothing"); |
591 | } | 591 | } |
592 | if (current->scratchpad && !current->workspace) { | ||
593 | return cmd_results_new(CMD_FAILURE, | ||
594 | "Cannot resize a hidden scratchpad container"); | ||
595 | } | ||
596 | |||
592 | 597 | ||
593 | struct cmd_results *error; | 598 | struct cmd_results *error; |
594 | if ((error = checkarg(argc, "resize", EXPECTED_AT_LEAST, 2))) { | 599 | if ((error = checkarg(argc, "resize", EXPECTED_AT_LEAST, 2))) { |
diff --git a/sway/commands/split.c b/sway/commands/split.c index ed370d26..06b7df5e 100644 --- a/sway/commands/split.c +++ b/sway/commands/split.c | |||
@@ -13,6 +13,10 @@ static struct cmd_results *do_split(int layout) { | |||
13 | struct sway_container *con = config->handler_context.container; | 13 | struct sway_container *con = config->handler_context.container; |
14 | struct sway_workspace *ws = config->handler_context.workspace; | 14 | struct sway_workspace *ws = config->handler_context.workspace; |
15 | if (con) { | 15 | if (con) { |
16 | if (con->scratchpad && !con->workspace) { | ||
17 | return cmd_results_new(CMD_FAILURE, | ||
18 | "Cannot split a hidden scratchpad container"); | ||
19 | } | ||
16 | container_split(con, layout); | 20 | container_split(con, layout); |
17 | } else { | 21 | } else { |
18 | workspace_split(ws, layout); | 22 | workspace_split(ws, layout); |
diff --git a/sway/commands/sticky.c b/sway/commands/sticky.c index 6cac8a45..15b726cc 100644 --- a/sway/commands/sticky.c +++ b/sway/commands/sticky.c | |||
@@ -29,7 +29,8 @@ struct cmd_results *cmd_sticky(int argc, char **argv) { | |||
29 | 29 | ||
30 | container->is_sticky = parse_boolean(argv[0], container->is_sticky); | 30 | container->is_sticky = parse_boolean(argv[0], container->is_sticky); |
31 | 31 | ||
32 | if (container->is_sticky) { | 32 | if (container->is_sticky && |
33 | (!container->scratchpad || container->workspace)) { | ||
33 | // move container to active workspace | 34 | // move container to active workspace |
34 | struct sway_workspace *active_workspace = | 35 | struct sway_workspace *active_workspace = |
35 | output_get_active_workspace(container->workspace->output); | 36 | output_get_active_workspace(container->workspace->output); |
diff --git a/sway/tree/root.c b/sway/tree/root.c index e1624863..e5df8dd1 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -87,6 +87,9 @@ void root_scratchpad_remove_container(struct sway_container *con) { | |||
87 | if (!sway_assert(con->scratchpad, "Container is not in scratchpad")) { | 87 | if (!sway_assert(con->scratchpad, "Container is not in scratchpad")) { |
88 | return; | 88 | return; |
89 | } | 89 | } |
90 | if (!con->workspace) { | ||
91 | root_scratchpad_show(con); | ||
92 | } | ||
90 | con->scratchpad = false; | 93 | con->scratchpad = false; |
91 | int index = list_find(root->scratchpad, con); | 94 | int index = list_find(root->scratchpad, con); |
92 | if (index != -1) { | 95 | if (index != -1) { |