The i3 FAQ has migrated to https://github.com/i3/i3/discussions. All content here is read-only.
Ask Your Question
2

Move any container directly where the last split was done

asked Feb 3 '14

Spheerys gravatar image

When I am on a workspace and I want to move a container, I don't like to move it with top/right/bottom/left move bindkeys (to much moves for me!!).

I prefer to do like this :

  1. I make the split somewhere
  2. I make floated the container I want to move
  3. I immediatly make it unfloated (and it goes to the right place, where I made the split)

But I'm looking for a way to make the step 2 and 3 with one bindkey (on one step).

Is it possible ?

1 answer

Sort by » oldest newest most voted
4

answered Feb 4 '14

Adaephon gravatar image

updated Oct 7 '15

Yes.

First use mark to save, where the last split happened. Just chain it to your normal split commands:

bindsym $mod+h split horizontal; mark lastsplit
bindsym $mod+v split vertical; mark lastsplit

Now you can move a window to the mark by one of these two methods, depending on your version of i3:

  • Since version 4.11 you can use the following to move to a mark.

    bindsym $mod+m move window to mark lastsplit
  • for older versions there is no direct way to move a window to a split. But there is a workaround using the scratchpad:

    When 'unfloating' a window, i3 drops it where it would also create a new window: just next to the focused (and tiled) one. So the window with the last split has to be focused immediately before disabling floating:

    bindsym $mod+m mark movethis; move scratchpad; [con_mark="^lastsplit$"] focus; [con_mark="^movethis$"] scratchpad show, floating disable

Now, on $mod+m the currently focused window will be moved to the last split. You can even move multiple windows to the same split.

Also, some binding to just set the mark, without splitting could come in handy.

Comments

There is an error : ``` ERROR: Expected one of these tokens: 'class', 'instance', 'window_role', 'con_id', 'id', 'con_mark', 'title', 'urgent', ']' ERROR: Your command: mark movethis; floating enable; [con_mark="^lastsplit$"] focus; [con_mark="^movethis$] focus, floating disable ```

Spheerys gravatar imageSpheerys (Feb 4 '14)edit

It's missing a quote. The correct line is : ``` bindsym $mod+m mark movethis; floating enable; [con_mark="^lastsplit$"] focus; [con_mark="^movethis$"] focus, floating disable ```

Spheerys gravatar imageSpheerys (Feb 4 '14)edit

@Spheerys: Thanks, I fixed it.

Adaephon gravatar imageAdaephon (Feb 4 '14)edit

Question Tools

Stats

Asked: Feb 3 '14

Seen: 268 times

Last updated: Oct 07