diff options
author | wil <[email protected]> | 2017-01-01 19:53:53 +0100 |
---|---|---|
committer | wil <[email protected]> | 2017-01-01 19:53:53 +0100 |
commit | a62048f15d9381e3040bd45965233e59a041eab7 (patch) | |
tree | 52e898bed50efcefe3d526db696d16f8888bc2f0 /sway/layout.c | |
parent | 15745abf0cb4948fcc750a9e78139d3c02e1c1f0 (diff) |
changed "layout promote" command to "move first"
This is more consistent with other Sway semantics.
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sway/layout.c b/sway/layout.c index 2de6da45..6212ec75 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -252,6 +252,7 @@ void swap_geometry(swayc_t *a, swayc_t *b) { void move_container(swayc_t *container, enum movement_direction dir) { enum swayc_layouts layout = L_NONE; + swayc_t *parent = container->parent; if (container->is_floating || (container->type != C_VIEW && container->type != C_CONTAINER)) { return; @@ -260,10 +261,23 @@ void move_container(swayc_t *container, enum movement_direction dir) { layout = L_VERT; } else if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { layout = L_HORIZ; + } else if (dir == MOVE_FIRST) { + // swap first child in auto layout with currently focused child + if (is_auto_layout(parent->layout)) { + int focused_idx = index_child(container); + swayc_t *first = parent->children->items[0]; + if (focused_idx > 0) { + list_swap(parent->children, 0, focused_idx); + swap_geometry(first, container); + } + arrange_windows(parent->parent, -1, -1); + ipc_event_window(container, "move"); + set_focused_container_for(parent->parent, container); + } + return; } else if (! (dir == MOVE_NEXT || dir == MOVE_PREV)) { return; } - swayc_t *parent = container->parent; swayc_t *child = container; bool ascended = false; |