diff options
author | Tudor Brindus <me@tbrindus.ca> | 2020-07-01 01:08:04 -0400 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-07-15 19:22:05 +0200 |
commit | 472dce662116bb13101e27ecb4b05b803ee21e64 (patch) | |
tree | 4c700eadf38f81594f5d373de9990ee80c05188d /sway/tree | |
parent | Update version to v1.5-rc2 (diff) | |
download | sway-472dce662116bb13101e27ecb4b05b803ee21e64.tar.gz sway-472dce662116bb13101e27ecb4b05b803ee21e64.tar.zst sway-472dce662116bb13101e27ecb4b05b803ee21e64.zip |
commands/move: unwrap workspace container on move to new workspace
If moving e.g. `T[app app]` into a new workspace with `workspace_layout
tabbed`, then post-move the tree in that workspace will be `T[T[app
app]]`. This still happens with horizontal or vertical workspace layout,
but is less visible since those containers have no decorations.
Fixes #5426.
(cherry picked from commit 92891fb1edef5136ae4eb35fec5b8523f031be81)
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/workspace.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 0fa28951..3bcba8e5 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -641,6 +641,21 @@ struct sway_container *workspace_wrap_children(struct sway_workspace *ws) { | |||
641 | return middle; | 641 | return middle; |
642 | } | 642 | } |
643 | 643 | ||
644 | void workspace_unwrap_children(struct sway_workspace *ws, | ||
645 | struct sway_container *wrap) { | ||
646 | if (!sway_assert(workspace_is_empty(ws), | ||
647 | "target workspace must be empty")) { | ||
648 | return; | ||
649 | } | ||
650 | |||
651 | ws->layout = wrap->layout; | ||
652 | while (wrap->children->length) { | ||
653 | struct sway_container *child = wrap->children->items[0]; | ||
654 | container_detach(child); | ||
655 | workspace_add_tiling(ws, child); | ||
656 | } | ||
657 | } | ||
658 | |||
644 | void workspace_detach(struct sway_workspace *workspace) { | 659 | void workspace_detach(struct sway_workspace *workspace) { |
645 | struct sway_output *output = workspace->output; | 660 | struct sway_output *output = workspace->output; |
646 | int index = list_find(output->workspaces, workspace); | 661 | int index = list_find(output->workspaces, workspace); |