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

Unexpected behavior when moving a window with moveToUnit #3624

Closed
cmpadden opened this issue Apr 7, 2024 · 2 comments
Closed

Unexpected behavior when moving a window with moveToUnit #3624

cmpadden opened this issue Apr 7, 2024 · 2 comments

Comments

@cmpadden
Copy link

cmpadden commented Apr 7, 2024

System

Hammerspoon: 0.9.93
macOS Sonoma: 14.3

Problem

When a new window is created that extends past the screens edge, resizing to a rectangle will be truncated. For example, if a window is created and hangs n pixels below the screen, it appears that the resulting window after calling moveToUnit is n pixels shorter than desired.

You can find a minimal example here, in which we subscribe to windowCreated events and resize the window in the callback function.

hs.window.setFrameCorrectness = true

local window_filter_all = hs.window.filter.new()
window_filter_all:subscribe(hs.window.filter.windowCreated, function(window, app_name)
    window:moveToUnit(RECT_CENTERED)
end)

This seems to primarily happen with Firefox.

See the included video demonstrating the behavior:

Screen.Recording.2024-04-06.at.10.45.51.PM.mov

As an aside, I've noticed that I sometimes have to call the move method multiple times before the window is in the location and dimension that I desire. This Reddit user has described similar behavior:

https://www.reddit.com/r/hammerspoon/comments/xz3xvy/window_manipulation_functions_misbehaving/

@cmpadden
Copy link
Author

cmpadden commented Apr 7, 2024

This may be a similar issue - #2586 (comment)

Attempted to check and re-check the accessibility setting with no luck.

@cmpadden
Copy link
Author

cmpadden commented Apr 7, 2024

Also likely related to this - #2316 (comment). Will close this issue and follow this one instead.

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

1 participant