Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make move_to_container insert after the focused child of destination to match i3 behavior #8418

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion sway/commands/move.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,26 @@ static void container_move_to_container(struct sway_container *container,
if (destination->view) {
container_add_sibling(destination, container, 1);
} else {
container_add_child(destination, container);
/* For split containers, we use the currently focused container within it.
* This allows setting marks on, e.g., tabbed containers which will move
* con to a new tab behind the focused tab. */
sway_log(SWAY_DEBUG, "target is a split container, descending to the currently focused child.");
struct sway_node *focused = seat_get_active_tiling_child(
config->handler_context.seat, &destination->node);
if (!focused || focused == &destination->node) {
// The container has no children
container_add_child(destination, container);
return;
}
struct sway_container *target = focused->sway_container;
int index = container_sibling_index(target) + 1;
if (target->pending.parent) {
container_insert_child(target->pending.parent, container, index);
} else {
// TODO: This branch is unreachable until workspaces can be marked.
// Issue url: https://github.com/swaywm/sway/issues/8474
workspace_insert_tiling(target->pending.workspace, container, index);
}
Comment on lines +274 to +278
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it makes sense to include a branch for a feature that doesn't exist.

}

if (container->view) {
Expand Down