Skip to content
New issue

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

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

Already on GitHub? # to your account

Add cmd --balance to yabai -m window [<WINDOW_SEL>] #190

Closed
kiryph opened this issue Aug 4, 2019 · 6 comments
Closed

Add cmd --balance to yabai -m window [<WINDOW_SEL>] #190

kiryph opened this issue Aug 4, 2019 · 6 comments
Labels
discussion Discussion suggestion Request for new feature or some form of enhancement

Comments

@kiryph
Copy link

kiryph commented Aug 4, 2019

Consider following layout (W1 has a larger width than W2-W4 and split type of W3 and W4 is toggled from vertical to horizontal)

+------------------+
|           |      |
|           |  W2  |
|           |      |
|     W1    |      |
|           |------|
|           |  W3  |
|           |------|
|           |  W4  |
+------------------+

I want to equalize the heights of W2, W3, W4 i.e. the layout should become on invocation of yabai -m window [W2] --balance

+------------------+
|           |  W2  |
|           |      |
|           |------|
|     W1    |  W3  |
|           |      |
|           |------|
|           |  W4  |
|           |      |
+------------------+

when W2 is active or explicitly specified. Just to be sure: the size of W1 should NOT change.

In other words balance current node with all its children.

Afaik, bspwm offers

*-B*, *--balance*::
	Adjust the split ratios of the tree rooted at the selected node so that all windows occupy the same area.
@dominiklohmann
Copy link
Collaborator

More generally speaking, would it make sense to allow some space commands to operate on window trees (and subtrees)? These commands would then work on windows (operating on the subtree that has the selected window as its root) and on the space (operating on the root node).

@koekeishiya
Copy link
Owner

I am not against having commands that allow operations (that make sense) on intermediate nodes, however I think that should be a separate domain of commands and selectors, if that is ever to become a thing.

I have thought about this since the middle stages of chunkwm, but was never able to come up with a simple and expressive syntax for the user to select a specific node in the tree using a cli, that I liked.

I don't think a balance command makes sense for the window domain, where we exclusively refer to windows (aka leaf nodes). Balancing a leaf node does not make sense.

@koekeishiya koekeishiya added discussion Discussion suggestion Request for new feature or some form of enhancement labels Sep 3, 2019
@koekeishiya
Copy link
Owner

koekeishiya commented Sep 23, 2022

I am still interested in doing something here. What I want to do is have some commands in the space domain be able to operate on subtrees in the selected space, but I haven't thought of a syntax to navigate nodes yet.

@Bellavene
Copy link

Bellavene commented Jan 3, 2025

#1633

What you want is config auto_balance x-axis. While I would be glad to have it built in,
I have a quick fix for auto_balance. You need to edit /src/view.c file in the source code.
Find in that file two lines starting with if (view->auto_balance), delete | SPLIT_Y from those functions. And compile Yabai. Works great.

@koekeishiya
Copy link
Owner

koekeishiya commented Jan 4, 2025

I can add x-axis and y-axis as additional options to auto_balance. I think that makes sense.

@koekeishiya
Copy link
Owner

Implemented auto_balance modification on master. Is this good enough to consider this issue resolved?

@koekeishiya koekeishiya added the addressed on master; not released Fixed upstream, but not yet released label Jan 7, 2025
@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Jan 22, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
discussion Discussion suggestion Request for new feature or some form of enhancement
Projects
None yet
Development

No branches or pull requests

4 participants