diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-11-03 17:11:41 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-11-03 17:11:41 -0500 |
commit | 58085226b33555d911a3ff27e456943701c9568f (patch) | |
tree | 9215b9bc42248d73c78980f641e511dffca38695 /sway/layout.c | |
parent | 0833fa0c7538c8e5cfdce5d1500360383b9a39f7 (diff) | |
parent | af31a3f04a808a526cbf210bc7762daef66a2f40 (diff) |
Merge pull request #205 from sce/focus_move_cont_to_adjacent_output
Learn focus / move container to adjacent output
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) { } } +void move_workspace_to(swayc_t* workspace, swayc_t* destination) { + if (workspace == destination || swayc_is_parent_of(workspace, destination)) { + return; + } + swayc_t *src_op = remove_child(workspace); + // reset container geometry + workspace->width = workspace->height = 0; + add_child(destination, workspace); + // Refocus destination (change to new workspace) + set_focused_container(get_focused_view(workspace)); + arrange_windows(destination, -1, -1); + update_visibility(destination); + + // make sure source output has a workspace + if (src_op->children->length == 0) { + char *ws_name = workspace_next_name(); + swayc_t *ws = new_workspace(src_op, ws_name); + ws->is_focused = true; + free(ws_name); + } + set_focused_container(get_focused_view(src_op)); + update_visibility(src_op); +} + void update_geometry(swayc_t *container) { if (container->type != C_VIEW) { return; |