Add the swap_workspace command

The added command allow the user to swap the contents of two workspaces.

Co-authored-by: Arne <ge47com@tum.de>
This commit is contained in:
Fabian Specht 2024-01-12 16:02:12 +01:00
parent c5fd8c050f
commit c2eaf01767
No known key found for this signature in database
GPG key ID: 3E324CC0E6232463
7 changed files with 211 additions and 0 deletions

View file

@ -430,6 +430,20 @@ struct sway_container *container_at(struct sway_workspace *workspace,
return NULL;
}
void container_get_first_view(struct sway_container *container,
struct sway_container **view) {
if (container->view) {
*view = container;
}
if (container->pending.children) {
for (int i = 0; i < container->pending.children->length; ++i) {
struct sway_container *child = container->pending.children->items[i];
container_get_first_view(child, view);
}
}
}
void container_for_each_child(struct sway_container *container,
void (*f)(struct sway_container *container, void *data),
void *data) {