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

Question: is it possible to auto-stack new windows? #674

Closed
alextremblay opened this issue Sep 28, 2020 · 5 comments
Closed

Question: is it possible to auto-stack new windows? #674

alextremblay opened this issue Sep 28, 2020 · 5 comments
Labels
question Request for information or help, not an issue

Comments

@alextremblay
Copy link

Hello,

Fisrt off, that you for making yabai and being so incredibly helpful to those who use it. it's appreciated :)

Is it possible to configure (on a per-space basis or globally) a rule like yabai -m window --insert stack, so that new windows created in that space automatically stack onto the most recent window?

My use case is that I really like stacks, but i also really like bsp layout and the ability to have more than one stack in a given space.
If i set the layout of a space to bsp, i can have multiple stacks but all new windows cause splits
If i set the layout of a space to stack, all new windows stack, but it's no longer possible to split a stack and have multiple stacks

I'm stuck on this one. Any advice or direction would be greatly appreciated

@dominiklohmann
Copy link
Collaborator

dominiklohmann commented Sep 28, 2020

You can cause the next insertion to happen in stack mode on the focused window whenever the focused window changes:

yabai -m signal --add event=window_focused action='yabai -m window $YABAI_WINDOW_ID --insert stack'
yabai -m signal --add event=application_front_switched action='yabai -m window --insert stack'

You can hide the insertion overlay by setting the config option insert_feedback_color.

yabai -m config insert_feedback_color 0x00FFFFFF

@dominiklohmann dominiklohmann added the question Request for information or help, not an issue label Sep 28, 2020
@alextremblay
Copy link
Author

awesome, thank you!

That's almost perfect

The only time it fails is if you close a window and create a new one. I added

yabai -m signal --add event=application_terminated action='yabai -m window --insert stack'
yabai -m signal --add event=window_destroyed action='yabai -m window --insert stack'

and now it's working great.

Thank you so much!

@stefanopagliari
Copy link

@alextremblay and @dominiklohmann thank you for this. It largely address what I was looking for.
Would it be possible to modify this so that new windows are stacked only if there are currently 3 windows on the screen?
I have a wide-screen and by default I prefer not to have more than three windows

@pyinto
Copy link

pyinto commented Jan 5, 2024

awesome, thank you!

That's almost perfect

The only time it fails is if you close a window and create a new one. I added

yabai -m signal --add event=application_terminated action='yabai -m window --insert stack'
yabai -m signal --add event=window_destroyed action='yabai -m window --insert stack'

and now it's working great.

Thank you so much!

Does this still work for you? Did you add anything else? I still see that windows sometimes open not in the stack.

@gennaro-tedesco
Copy link

I too see no effect in bsp layouts with the above configurations, namely new windows still open in a new tile (horizontal or vertical) rather than stack on the existing ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Request for information or help, not an issue
Projects
None yet
Development

No branches or pull requests

5 participants