diff options
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sway/layout.c b/sway/layout.c index cb4d6937..c6a05107 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -317,6 +317,30 @@ void move_container_to(swayc_t* container, swayc_t* destination) { | |||
317 | } | 317 | } |
318 | } | 318 | } |
319 | 319 | ||
320 | void move_workspace_to(swayc_t* workspace, swayc_t* destination) { | ||
321 | if (workspace == destination || swayc_is_parent_of(workspace, destination)) { | ||
322 | return; | ||
323 | } | ||
324 | swayc_t *src_op = remove_child(workspace); | ||
325 | // reset container geometry | ||
326 | workspace->width = workspace->height = 0; | ||
327 | add_child(destination, workspace); | ||
328 | // Refocus destination (change to new workspace) | ||
329 | set_focused_container(get_focused_view(workspace)); | ||
330 | arrange_windows(destination, -1, -1); | ||
331 | update_visibility(destination); | ||
332 | |||
333 | // make sure source output has a workspace | ||
334 | if (src_op->children->length == 0) { | ||
335 | char *ws_name = workspace_next_name(); | ||
336 | swayc_t *ws = new_workspace(src_op, ws_name); | ||
337 | ws->is_focused = true; | ||
338 | free(ws_name); | ||
339 | } | ||
340 | set_focused_container(get_focused_view(src_op)); | ||
341 | update_visibility(src_op); | ||
342 | } | ||
343 | |||
320 | void update_geometry(swayc_t *container) { | 344 | void update_geometry(swayc_t *container) { |
321 | if (container->type != C_VIEW) { | 345 | if (container->type != C_VIEW) { |
322 | return; | 346 | return; |