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

Window sent to different display with size doesn't appear to get resized #226

Closed
chandlerc opened this issue Aug 30, 2019 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@chandlerc
Copy link

Steps to reproduce:

  1. Start an app on one display
  2. Move it to a different display with a different (smaller in my case) size

The result is that the window resize isn't triggered AFAICT. I see this when using Kitty, so its possible its specific to Kitty, but I don't think so...

The window bleeds off the right side of the new display, occluding the gap I typically have, so the window itself seems the wrong size, not just the contents. Kitty also doesn't re-draw the contents, etc. Weirdly, the top and bottom gap (and menubar) are visible. Not sure why.

Let me know if you need screenshots or more info.

@koekeishiya koekeishiya added the bug Something isn't working label Aug 30, 2019
@dominiklohmann
Copy link
Collaborator

This is either a macOS bug or we're using the undocumented and reverse engineered resize functions wrongly. Sometimes, macOS fails to resize windows that are moved to a smaller display, when these would be overlapping to the bottom or right side of the display.

Additionally, macOS fails to resize windows sent to an inactive space on another display.

This has previously been discussed as part of #112 if I recall correctly. There is currently no workaround in yabai for this, as this issue is hard to reproduce reliably.

A simple repeat 2 yabai -m space --toggle padding works as a quick layout reset if you want to work around the bug in a script.

Let me know if you need screenshots or more info.

There have been many changes on master since the last release, so generally it's good to know whether people are running the latest release or the latest master.

There are currently 23 issues labeled addressed not released, including lots of changes to queries, rules, and signals.

@chandlerc
Copy link
Author

It reproduces reliably for me (every time).

The target space is active on a different display.

The specific case that is reliably happening does seem to be when moving from a large display to a smaller one and would overlap both the bottom and right of the display.

I'm happy to give a building and running from master a try.

koekeishiya added a commit that referenced this issue Aug 31, 2019
@koekeishiya
Copy link
Owner

koekeishiya commented Aug 31, 2019

I can no longer reproduce this after the latest change to master (just now).

The following is not directly related to this issue, but just window movement on macOS in general..

yabai uses the macOS Accessibility API to adjust the dimensions of a window, and they are fairly crappy to put it that way. The resize call can fail for no apparent reason, or at least the API does not report an error code, so what I have done is simply just try to perform the resize twice for these scenarios.

Now there are private functions that can be used to move a window, caused by the WindowServer, rather than notifying the application through the AX API, that we can leverage through our code-injection into Dock.app. The reason why I am not using this, is that it does not play well with the other actions of the accessibility API. That is, it is not possible to combine the resize-function of the accessibility API with the private SLSMoveWindow function.

The accessibility API appear to keep a cache of the windows frame and I have yet to find a way to invalidate or force a refresh of the cache.

@koekeishiya koekeishiya added the addressed on master; not released Fixed upstream, but not yet released label Aug 31, 2019
@chandlerc
Copy link
Author

FWIW, this seems to work for me. Let you close or leave w/ the "not released" tag.

Thanks!

@koekeishiya koekeishiya removed the addressed on master; not released Fixed upstream, but not yet released label Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants