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

Feature request: another option to split containers #3238

Open
chrm opened this Issue Apr 13, 2018 · 5 comments

Comments

Projects
None yet
3 participants
@chrm

chrm commented Apr 13, 2018

A container can be set to either split horizontally or vertically. I'm suggesting a third option that would split a container depending on it's proportions.

If the container is wider than tall -> split horizontally
If the container is taller than wide -> split vertically

I think it would be much easier and faster to get a nice layout this way. Imagine what happens when you have a 16:9 screen and open four windows. If the screen is set to split horizontally you get four thin windows side by side, each taking up 1/4 of the screen. If the screen is set to split by proportion you get one window taking up 1/2 of the screen, one window with 1/4, and two with 1/8.

Also, each time you open a new window, only one other window has to be resized to make room. That helps with keeping the windows you already have open at the right size.

@i3bot i3bot added the enhancement label Apr 13, 2018

@Airblader Airblader added the 4.15 label Apr 14, 2018

@Airblader

This comment has been minimized.

Member

Airblader commented Apr 14, 2018

You can achieve this easily by executing split toggle whenever a new window opens (perhaps with the exception of the first window on a workspace, depending on your taste). So this can be trivially achieved via the IPC (or even configuration only).

@Airblader Airblader closed this Apr 14, 2018

@chrm

This comment has been minimized.

chrm commented Apr 14, 2018

As far as I can tell it's not that easy. You have to use split toggle before you open a new window and after you close a window. Otherwise the next split will be in the wrong orientation.

You can automate that if you only open and close windows with keybindings from your i3 config file, but that breaks down if you also open or close windows in other ways. For example by starting a browser window from a terminal, or closing the last browser tab with ctrl+w instead of $mod+Shift+q.

Workspaces kinda have that behavior already. See "4.8. Orientation for new workspaces".

@Airblader

This comment has been minimized.

Member

Airblader commented Apr 16, 2018

Reopening for now.

@Airblader Airblader reopened this Apr 16, 2018

@chrm

This comment has been minimized.

chrm commented Apr 17, 2018

After tinkering with my configuration for a while I just realised, my description wasn't very good. I was thinking about a container that in some cases doesn't exist yet. Let me try again.

The split direction of a workspace already gets set accordingly to it's proportions. That means, if you have only one window on a workspace, the first split will half that window and put the new window on the right (wide workspace) or on the bottom (tall workspace). I'm suggesting an option to make that behavior recursive.

I think it's visually more intuitive than the approach to squish everything in the current container and put the new window at the end.

Here is how I think it could work. Keep in mind, I have not looked at the source code yet.

Lets call it split-recursive.

if i3 has to create a new window
    take the focused window W and its container C
    if container C is set to split-recursive
        if window W is the only thing in container C
            create the new window W2 in container C, acording to C's proportions
        else
            put a new container C2 around window W
            set C2 to split-recursive
            create the new window W2 in container C2, acording to C2's proportions
@Airblader

This comment has been minimized.

Member

Airblader commented Apr 18, 2018

This would require us to constantly create new containers on our own. I'm not a fan of that idea, it's not something we really do or want to do.

What about https://github.com/olemartinorg/i3-alternating-layout? That seems to do exactly what you want, no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment