diff options
Diffstat (limited to 'sway/tree/workspace.c')
-rw-r--r-- | sway/tree/workspace.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 74330884..7d180009 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c | |||
@@ -208,45 +208,6 @@ struct sway_container *workspace_create(const char *name) { | |||
208 | return new_ws; | 208 | return new_ws; |
209 | } | 209 | } |
210 | 210 | ||
211 | struct sway_container *container_workspace_destroy( | ||
212 | struct sway_container *workspace) { | ||
213 | if (!sway_assert(workspace, "cannot destroy null workspace")) { | ||
214 | return NULL; | ||
215 | } | ||
216 | |||
217 | // Do not destroy this if it's the last workspace on this output | ||
218 | struct sway_container *output = container_parent(workspace, C_OUTPUT); | ||
219 | if (output && output->children->length == 1) { | ||
220 | return NULL; | ||
221 | } | ||
222 | |||
223 | struct sway_container *parent = workspace->parent; | ||
224 | if (workspace->children->length == 0) { | ||
225 | // destroy the WS if there are no children (TODO check for floating) | ||
226 | wlr_log(L_DEBUG, "destroying workspace '%s'", workspace->name); | ||
227 | ipc_event_workspace(workspace, NULL, "empty"); | ||
228 | } else { | ||
229 | // Move children to a different workspace on this output | ||
230 | struct sway_container *new_workspace = NULL; | ||
231 | // TODO move floating | ||
232 | for (int i = 0; i < output->children->length; i++) { | ||
233 | if (output->children->items[i] != workspace) { | ||
234 | new_workspace = output->children->items[i]; | ||
235 | break; | ||
236 | } | ||
237 | } | ||
238 | |||
239 | wlr_log(L_DEBUG, "moving children to different workspace '%s' -> '%s'", | ||
240 | workspace->name, new_workspace->name); | ||
241 | for (int i = 0; i < workspace->children->length; i++) { | ||
242 | container_move_to(workspace->children->items[i], new_workspace); | ||
243 | } | ||
244 | } | ||
245 | |||
246 | container_destroy(workspace); | ||
247 | return parent; | ||
248 | } | ||
249 | |||
250 | /** | 211 | /** |
251 | * Get the previous or next workspace on the specified output. Wraps around at | 212 | * Get the previous or next workspace on the specified output. Wraps around at |
252 | * the end and beginning. If next is false, the previous workspace is returned, | 213 | * the end and beginning. If next is false, the previous workspace is returned, |