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

Allow splitting into any kind of layout #4208

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open

Conversation

AMDmi3
Copy link

@AMDmi3 AMDmi3 commented Sep 23, 2020

This should solve #4207, I've successfully tested this as a patch to 4.18.2.

This change introduces tabbed, stacking, stacked modes to split command in a backward compatible way (t still works as toggle).

Additionaly, this changes behavior which replaces the layout of current container (instead of creating a nested container) if the container only has one child: while before it only worked for splits, now it works for all layouts which is IMO more consistent.

Fixes #4207
Closes #3001

@AMDmi3
Copy link
Author

AMDmi3 commented Sep 23, 2020

There seem to be a broken test related to

Additionaly, this changes behavior which replaces the layout of current container (instead of creating a nested container) if the container only has one child: while before it only worked for splits, now it works for all layouts which is IMO more consistent.

Can revert the bahavior or fix the test, depending on which behavior is desired.

@orestisfl
Copy link
Member

There seem to be a broken test related to

Additionaly, this changes behavior which replaces the layout of current container (instead of creating a nested container) if the container only has one child: while before it only worked for splits, now it works for all layouts which is IMO more consistent.

Can revert the bahavior or fix the test, depending on which behavior is desired.

So, the behavior of layout stacked is affected? This is certainly not desirable.

@orestisfl orestisfl added the waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment. label Oct 13, 2020
@AMDmi3
Copy link
Author

AMDmi3 commented Oct 13, 2020

So, the behavior of layout stacked is affected?

It is not, it only affects splits.

@orestisfl orestisfl removed the waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment. label Oct 13, 2020
@orestisfl
Copy link
Member

Sounds good, this will also fix #3001.

Can you fix the test and include new ones that test the new behavior please?

@orestisfl orestisfl added the waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment. label Oct 13, 2020
@AMDmi3
Copy link
Author

AMDmi3 commented Oct 13, 2020

Sorry, short on time right away, will do this next week

@wlhlm
Copy link
Contributor

wlhlm commented Oct 26, 2020

Thanks for taking a stab at implementing this! ❤️ This fixes one of the annoyances I've had with i3's windowing.

What follows is a patch that is better handled in a separate PR Here is a patch that draws indicators for the new splits (as it already does for horizontal and vertical). For stacked, it draws the indicator over the top border, mirroring the vertical split indicator. I don't this think will be confused with the vertical split as that will always split at the bottom (as far as I know), opposite of where the stacked split indicator would be drawn. The tabbed indicator also draws over the top border, but only for half the width, sort of mimicking a tab.
diff --git a/src/x.c b/src/x.c
index def79ef2..5348764c 100644
--- a/src/x.c
+++ b/src/x.c
@@ -588,6 +588,12 @@ void x_draw_decoration(Con *con) {
             } else if (p->parent_layout == L_SPLITV) {
                 draw_util_rectangle(&(con->frame_buffer), p->color->indicator,
                                     br.x, r->height + (br.height + br.y), r->width + br.width, -(br.height + br.y));
+            } else if (p->parent_layout == L_STACKED) {
+                draw_util_rectangle(&(con->frame_buffer), p->color->indicator,
+                                    br.x, br.y, r->width + br.width, br.height);
+            } else if (p->parent_layout == L_TABBED) {
+                draw_util_rectangle(&(con->frame_buffer), p->color->indicator,
+                                    br.x, br.y, (r->width + br.width) / 2, br.height);
             }
         }
     }

Here is a preview with increased border size. Tabbed split is on the left, and stacked on the right:

Screenshot-2020-10-26-110024

@Airblader
Copy link
Member

@wlhlm Your patch seems to fit issue #1067 more than this PR.

@wlhlm
Copy link
Contributor

wlhlm commented Oct 26, 2020

Huh, I totally forgot to check if this has been discussed before. Though I'm not surprised that it has.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Waiting for feedback/changes from the author of the issue/PR. Make sure to notify us with a comment.
Projects
None yet
4 participants