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

"Move window" command or IPC request #3564

Open
CyberShadow opened this Issue Dec 14, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@CyberShadow
Copy link
Contributor

CyberShadow commented Dec 14, 2018

I'm submitting a…

[ ] Bug
[x] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

In many cases, when improving i3 itself is not an option (e.g. due to low expected usage of the requested functionality), the suggestion is usually to implement it as an additional script, which makes use of i3's IPC interface. From there, it is trivial to query i3's tree and all containers' properties, however manipulating the tree is occasionally non-trivial.

Reducing tree manipulation to a single primitive, it would likely be "move container X into container Y at index Z"; however, there is no such primitive in the protocol, and it is not obvious how to achieve this task through other means.

Aside from certain narrow cases handled by simple commands like move up, the best approach for arbitrary tree manipulation I found is [con_id=Y] mark --add target ; [con_id=X] move container to mark target. However, this is still lacking in several ways:

  • There is no way to specify the index, so the above must be followed by a series of swap commands to position the moved container at its correct place in its new parent container.
  • It is possible to place the moved container at a specific place in its new parent if its new prior sibling happens to be a leaf (window), but even with an all-leaves target container, it is still not possible to insert it at the beginning of the container.
  • Moving the container in such a fashion causes it to lose focus.
  • It does not appear to be possible to move a container up to a workspace container. Though mark seems to have some effect on workspace containers, attempting to move a container to a mark placed on its workspace seems to have no effect. (I'm not sure if this is a bug, or expected behavior due to i3's internal design.)

Desired Behavior

Ideally, there would be a command like:

move container to <criteria> [at <index>]

or:

move container before|after <criteria>

Used with criteria indicating the container to be moved, this should achieve the goal of allowing moving any subtree to any place in the i3 tree, though other approaches at addressing the general problem likely exist.

@i3bot i3bot added the enhancement label Dec 14, 2018

@CyberShadow

This comment has been minimized.

Copy link
Contributor

CyberShadow commented Dec 15, 2018

Though mark seems to have some effect on workspace containers, attempting to move a container to a mark placed on its workspace seems to have no effect. (I'm not sure if this is a bug, or expected behavior due to i3's internal design.)

Looks like it's by design. The attempt is accompanied by these log messages:

2018-12-15 03:26:55 - con.c:con_move_to_mark:1328 - target container is a workspace, simply moving the container there.
2018-12-15 03:26:55 - con.c:con_move_to_workspace:1374 - Not moving, already there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment