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

Can't warp out of a stack (unless managed window located) #1252

Closed
diocletiann opened this issue Apr 27, 2022 · 11 comments
Closed

Can't warp out of a stack (unless managed window located) #1252

diocletiann opened this issue Apr 27, 2022 · 11 comments

Comments

@diocletiann
Copy link

Would it be possible to allow warping out of stack in a cardinal direction even if could not locate a managed window is true? It would allow for "i3-like" tile movement and chaining of stack/warp commands across stacks, spaces, and displays. I tried the toggle float twice trick but that only works well as the very last command which prevents stacking into other spaces/displays. Thanks!

@diocletiann
Copy link
Author

diocletiann commented Apr 27, 2022

Now that I'm thinking about it, something like yabai -m window --unstack DIR_SEL would work better since there are cases where you'd prefer warp to fail if nothing is there, for example chaining to focus stack.next/prev.

@diocletiann
Copy link
Author

diocletiann commented Apr 27, 2022

Actually, even single unstack command that can fail (unlike toggle float) would work with some rotation or mirroring after.

@diocletiann
Copy link
Author

#671 (comment) This looks like it should work. I'll try later and close if it does.

@diocletiann
Copy link
Author

diocletiann commented Apr 29, 2022

I modified @alextremblay's script to not float/un-float if the window isn't stacked and there is no valid target. I didn't know the insert command worked with toggle float. This is working pretty well.

#!/usr/bin/env bash

# dir should be one of east,west,north,south
dir=$1

window=$(yabai -m query --windows --window | jq -r '.id')

# stack this window onto existing stack if possible
yabai -m window $dir --stack $window

# otherwise, float and un-float this window to reinsert it into the bsp tree as a new window
if [[ $? -ne 0 ]] && (yabai -m query --windows --window | jq -e '."stack-index" != 0'); then
    yabai -m window --insert $dir \
    && yabai -m window $window --toggle float \
    && yabai -m window $window --toggle float
fi

@alextremblay
Copy link

Nice!

@b4rlw
Copy link

b4rlw commented May 16, 2022

Nice mod! I've been enjoying @alextremblay's original script for a while now.

Do you ever get this bug when moving a window out of a stack @restfuladi? The window gets blocked over in red when pulling a window somewhere out the master stack to its own window. Fixes itself when repeating the action, but still annoying.

Screenshot 2022-05-16 at 23 41 01

@diocletiann
Copy link
Author

Nice mod! I've been enjoying @alextremblay's original script for a while now.

Do you ever get this bug when moving a window out of a stack @restfuladi? The window gets blocked over in red when pulling a window somewhere out the master stack to its own window. Fixes itself when repeating the action, but still annoying.

Screenshot 2022-05-16 at 23 41 01

Thanks, it's the closest I've gotten to i3 behavior. I get the same glitch but I just re-do the action and then it doesn't happen for while.

@b4rlw
Copy link

b4rlw commented May 17, 2022

@restfuladi Do you know if it's possible to stack all windows in a space while in BSP layout with a single command?Frequently, I find myself wanting to stack everything, then maybe warp out some windows. Problem is, it can be quite time consuming to manually stack everything in BSP.
Of course, you can assign a command for stack layout (I use hyper - s), but then you can't warp out!

@diocletiann
Copy link
Author

@restfuladi Do you know if it's possible to stack all windows in a space while in BSP layout with a single command?Frequently, I find myself wanting to stack everything, then maybe warp out some windows. Problem is, it can be quite time consuming to manually stack everything in BSP. Of course, you can assign a command for stack layout (I use hyper - s), but then you can't warp out!

Now that you mention it that would be useful. I guess you could query all the windows IDs in a space and stack all but the first into the first one.

@b4rlw
Copy link

b4rlw commented May 17, 2022

Now that you mention it that would be useful. I guess you could query all the windows IDs in a space and stack all but the first into the first one.

Good idea! I'll try and do this when I have some free time.

@diocletiann
Copy link
Author

Now that you mention it that would be useful. I guess you could query all the windows IDs in a space and stack all but the first into the first one.

Good idea! I'll try and do this when I have some free time.

I added i3-style rotation to the script, you might find it useful:
#1286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants