diff options
-rw-r--r-- | include/sway/tree/container.h | 2 | ||||
-rw-r--r-- | sway/commands/focus.c | 2 | ||||
-rw-r--r-- | sway/tree/container.c | 7 | ||||
-rw-r--r-- | sway/tree/root.c | 5 |
4 files changed, 15 insertions, 1 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 62c6556b..5cf5b6b1 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h | |||
@@ -357,4 +357,6 @@ void container_raise_floating(struct sway_container *con); | |||
357 | 357 | ||
358 | bool container_is_scratchpad_hidden(struct sway_container *con); | 358 | bool container_is_scratchpad_hidden(struct sway_container *con); |
359 | 359 | ||
360 | bool container_is_scratchpad_hidden_or_child(struct sway_container *con); | ||
361 | |||
360 | #endif | 362 | #endif |
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index d745aab5..56c3d981 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -365,7 +365,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
365 | } | 365 | } |
366 | 366 | ||
367 | if (argc == 0 && container) { | 367 | if (argc == 0 && container) { |
368 | if (container_is_scratchpad_hidden(container)) { | 368 | if (container_is_scratchpad_hidden_or_child(container)) { |
369 | root_scratchpad_show(container); | 369 | root_scratchpad_show(container); |
370 | } | 370 | } |
371 | seat_set_focus_container(seat, container); | 371 | seat_set_focus_container(seat, container); |
diff --git a/sway/tree/container.c b/sway/tree/container.c index aa819be7..56cdee1d 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -1527,3 +1527,10 @@ void container_raise_floating(struct sway_container *con) { | |||
1527 | bool container_is_scratchpad_hidden(struct sway_container *con) { | 1527 | bool container_is_scratchpad_hidden(struct sway_container *con) { |
1528 | return con->scratchpad && !con->workspace; | 1528 | return con->scratchpad && !con->workspace; |
1529 | } | 1529 | } |
1530 | |||
1531 | bool container_is_scratchpad_hidden_or_child(struct sway_container *con) { | ||
1532 | while (con->parent) { | ||
1533 | con = con->parent; | ||
1534 | } | ||
1535 | return con->scratchpad && !con->workspace; | ||
1536 | } | ||
diff --git a/sway/tree/root.c b/sway/tree/root.c index 46a140ef..ebd185ec 100644 --- a/sway/tree/root.c +++ b/sway/tree/root.c | |||
@@ -132,6 +132,11 @@ void root_scratchpad_show(struct sway_container *con) { | |||
132 | if (old_ws) { | 132 | if (old_ws) { |
133 | container_detach(con); | 133 | container_detach(con); |
134 | workspace_consider_destroy(old_ws); | 134 | workspace_consider_destroy(old_ws); |
135 | } else { | ||
136 | // Act on the ancestor of scratchpad hidden split containers | ||
137 | while (con->parent) { | ||
138 | con = con->parent; | ||
139 | } | ||
135 | } | 140 | } |
136 | workspace_add_floating(new_ws, con); | 141 | workspace_add_floating(new_ws, con); |
137 | 142 | ||