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

windows are not resized after insert (from fullscreen mode) #1481

Closed
nikita-orca opened this issue Oct 11, 2022 · 16 comments
Closed

windows are not resized after insert (from fullscreen mode) #1481

nikita-orca opened this issue Oct 11, 2022 · 16 comments

Comments

@nikita-orca
Copy link

Open any window in fullscreen mode
yabai -m window --toggle zoom-fullscreen
Create another window and exit fullscreen mode

The new window is placed on top, old window hasn't been resized

@occludedpixel
Copy link

occludedpixel commented Oct 12, 2022

When you say

Create another window and exit fullscreen mode

Do you switch focus back to the old window before toggling fullscreen mode?

Also, does the new window end up in fullscreen at this point?

The new window is placed on top, old window hasn't been resized

@nikita-orca
Copy link
Author

When I create a new window, the old fullscreen window (not native fullscreen) loses fullscreen. The layout isn't chaning

@occludedpixel
Copy link

Sorry, I'm a bit confused about what you're saying. Could I clarify whether the following steps match what you are doing? In the steps, I make reference to an attached screen recording of me going through the same steps.

  1. open an app (in the video I open the terminal)
  2. toggle full screen of the app
  3. open another app (in the video the Reminders app)
  4. switch focus back to the first app and toggle full screen for that app
CleanShot.2022-10-13.at.12.47.32-converted.2.mp4

If I am doing the same steps as you, could you explain how the behaviour on your system differs from the recording?

@nikita-orca
Copy link
Author

screen.mp4
  1. Have 2 open windows
  2. Fullscreen window on the right
  3. open another window (I'm using a keyboard shortcut)
  4. new window is placed on top, grabbing focus, and a fullscreen window is automatically toggled back

@dimitarvdimitrov
Copy link

dimitarvdimitrov commented Oct 17, 2022

I am also seeing the same behaviour that @nikita-orca recorded after upgrading from 4.x.x (don't remember which one exactly, sorry) to 5.0.0

edit: macos monterey 12.6, yabai-v5.0.0, M1 Pro

@occludedpixel
Copy link

@nikita-orca Could I check what's the behaviour you're expecting instead in your recording? Is it one of the following?

  1. Are you expecting the fullscreen terminal window to be resized to the top right corner (taking up quarter of total space) when you open the second terminal window? If that's the case, I'm afraid that's no longer the expected behaviour (please the reply to @dimitarvdimitrov below).
  2. Otherwise, are you expecting the fullscreen terminal window to remain fullscreen and the second window to be placed on top? This is what happens when I do what you did in the video with 3 windows instead of 2 so I think there's a bug here which can be fixed by adjusting the following line
    : node->zoom == node->parent

    to : node->zoom == node->parent && node->zoom != view->root.

@dimitarvdimitrov In 4.0.4 opening a new window when there's a window currently in fullscreen would cause the fullscreen window to revert back to normal. In 5.0.0, the behaviour has changed to keeping the fullscreen window in fullscreen and placing the new window on top. #864 looks like the specific change in 5.0.0 responsible.

@dimitarvdimitrov
Copy link

so it looks like it's working as intended. What do you think about making this un-fullscreen behaviour a config option - e.g. unzoom_on_new_window?

@nikita-orca
Copy link
Author

@occludedpixel I would like yabai to turn off fullscreen when a new window is added
But I see #864, so that's not possible currently

So it would be nice to fix the bug at least

@nikita-orca
Copy link
Author

@koekeishiya could you do this fix, please?
#1481 (comment)

@occludedpixel
Copy link

I looked into this

So it would be nice to fix the bug at least

a bit more and realised that the change I suggested here

to : node->zoom == node->parent && node->zoom != view->root.

would also cause unexpected behaviour: if you had two windows open and --toggle zoom-parent one of them then open a third window, the zoom-parent window would be zoomed fullscreen instead parent (so basically the opposite of the current issue happens).

It looks like the underlying cause is that whenever it comes to a situation where there are two windows in a space, zoom-parent and zoom-fullscreen fold into one and subsequently we are unable to determine whether the zoomed window is supposed to be fullscreen or parent (currently it is taken to be parent).

Maybe there needs to be a separate boolean field in window_node to distinguish between the two?

@occludedpixel
Copy link

@nikita-orca As for this

I would like yabai to turn off fullscreen when a new window is added But I see #864, so that's not possible currently

The following signal should be able to do it if an unzoom_on_new_window option suggested by @dimitarvdimitrov doesn't get added.

yabai -m signal --add event=window_focused action='if [[ $(yabai -m query --windows --window | jq ".\"is-floating\"") == "false" ]]; then
win_id=$(yabai -m query --windows --space | jq "map(select(.\"has-fullscreen-zoom\" and (.\"has-focus\" | not)))[0].id")
if [[ $win_id != "null" ]]; then yabai -m window $win_id --toggle zoom-fullscreen; fi
fi'

I've been using this signal to automatically unzoom windows even when switching window focus (in yabai v4.x.x the unzooming would happen when adding windows but not switching). However, this

@koekeishiya could you do this fix, please? #1481 (comment)

still needs to be addressed before the signal is able to achieve the behaviour you desire in your screen recording

screen.mp4

@nikita-orca
Copy link
Author

up

@dimitarvdimitrov
Copy link

dimitarvdimitrov commented Oct 29, 2022

thanks @occludedpixel, this signal works well as a workaround for me

@nikita-orca
Copy link
Author

It's not working for me :(

@mil-ad
Copy link

mil-ad commented Nov 2, 2022

The signal kind of works but it's janky. It takes a moment for it to realise something's changed and then everything kind of rejiggles into the right place.

@koekeishiya
Copy link
Owner

Made zoom persistence configurable; yabai -m config window_zoom_persist on|off

@koekeishiya koekeishiya added the addressed on master; not released Fixed upstream, but not yet released label Dec 28, 2022
@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Mar 28, 2023
shinyquagsire23 pushed a commit to shinyquagsire23/yabai that referenced this issue Jun 7, 2023
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

5 participants