Bug Description
When Use screen with cursor is enabled, applying Maximize to a window that is currently on one display while the cursor is on another display may require two attempts.
The first attempt moves the window to the target display but leaves it only partially maximized. A second Maximize immediately afterward works correctly.
This appears to be specific to cross-display resizes. If any other Loop action is performed after moving the window to the target display, then Maximize works correctly on the next attempt.
Steps To Reproduce
- Enable Use screen with cursor.
- Disable window resize animations.
- Put a resizable window on display A.
- Move the cursor to display B.
- Open Loop and choose Maximize once.
- Observe that the window moves to display B but is not fully maximized vertically.
- Choose Maximize again.
- Observe that the second attempt correctly fills display B.
Expected Behavior
A single Maximize action should move the window to the display under the cursor and apply the final maximized frame in that same operation.
Actual Behavior
The first cross-display Maximize moves the window to the new display but can leave it vertically constrained. A second Maximize is required.
Reproduction Data
Loop version: 🧪 1.4.3 (1763)
Relevant settings:
useScreenWithCursor = 1
useSystemWindowManagerWhenAvailable = 0
animateWindowResizes = 0
moveCursorWithWindow = 0
For one reproduction with ChatGPT:
Loop computed and requested this target frame:
(-1074.0, -370.0, 1068.0, 1878.0)
Loop log:
[ResizeContext] Computed target frame - raw: (-1074.0, -370.0, 1068.0, 1878.0), ... for action: WindowAction(direction: Maximize, name: Maximizar)
[WindowEngine] Resizing Window(id: 60994, app: 'ChatGPT', title: 'ChatGPT) to (-1074.0, -370.0, 1068.0, 1878.0)
Immediately after the first failed resize, Accessibility reported the actual window frame as:
x=-1074 y=-156 w=1068 h=1450
So the X position and width were correct, but the vertical geometry remained constrained. This suggests the target frame calculation is correct and the issue occurs while applying the frame during the display transition.
Possible Cause
In the current code path, cross-display resizes use:
await window.setFrame(targetFrame, sizeFirst: willChangeScreens, resolvedProperties: resolvedProperties)
and Window.setFrame(..., sizeFirst: true) applies size before position, then size again.
My suspicion is that the first size assignment is constrained by the old display, and the immediate second size assignment may occur before macOS has fully updated the window's display membership.
A potentially more robust approach may be to move the window to the destination display, wait until ScreenUtility.screenContaining(window) resolves to the destination screen, and then apply the final target frame.
Additional Context
This is reproducible specifically when moving between displays and maximizing in the same action. If the window is already on the destination display, Maximize works on the first attempt.
I can provide more logs or test a patch if useful.
Bug Description
When Use screen with cursor is enabled, applying Maximize to a window that is currently on one display while the cursor is on another display may require two attempts.
The first attempt moves the window to the target display but leaves it only partially maximized. A second Maximize immediately afterward works correctly.
This appears to be specific to cross-display resizes. If any other Loop action is performed after moving the window to the target display, then Maximize works correctly on the next attempt.
Steps To Reproduce
Expected Behavior
A single Maximize action should move the window to the display under the cursor and apply the final maximized frame in that same operation.
Actual Behavior
The first cross-display Maximize moves the window to the new display but can leave it vertically constrained. A second Maximize is required.
Reproduction Data
Loop version: 🧪 1.4.3 (1763)
Relevant settings:
For one reproduction with ChatGPT:
Loop computed and requested this target frame:
Loop log:
Immediately after the first failed resize, Accessibility reported the actual window frame as:
So the X position and width were correct, but the vertical geometry remained constrained. This suggests the target frame calculation is correct and the issue occurs while applying the frame during the display transition.
Possible Cause
In the current code path, cross-display resizes use:
and
Window.setFrame(..., sizeFirst: true)applies size before position, then size again.My suspicion is that the first size assignment is constrained by the old display, and the immediate second size assignment may occur before macOS has fully updated the window's display membership.
A potentially more robust approach may be to move the window to the destination display, wait until
ScreenUtility.screenContaining(window)resolves to the destination screen, and then apply the final target frame.Additional Context
This is reproducible specifically when moving between displays and maximizing in the same action. If the window is already on the destination display, Maximize works on the first attempt.
I can provide more logs or test a patch if useful.