window management: bump almost maximize to 90%, suppress resize anima…#397
Conversation
…tion Increase the "Almost Maximize" layout from 80% to 90% of the work area (both native Swift path and JS fallback). Also suppress the window resize animation for all window management commands by temporarily toggling AXEnhancedUserInterface off on the target app before setting bounds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bec375a4f6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
|
||
| if hasPid { | ||
| let appRef = AXUIElementCreateApplication(pid) | ||
| AXUIElementSetAttributeValue(appRef, "AXEnhancedUserInterface" as CFString, kCFBooleanTrue) |
There was a problem hiding this comment.
Restore AXEnhancedUserInterface to prior value, not always true
setWindowFrame unconditionally writes AXEnhancedUserInterface = true after resizing, even though it never reads the app’s previous value. For apps that already had this attribute set to false (or a non-default value), every window-management command now permanently flips their setting, which is a behavior regression outside this function’s scope. Capture the original attribute value and restore that value instead of forcing true.
Useful? React with 👍 / 👎.
| AXUIElementSetAttributeValue(appRef, "AXEnhancedUserInterface" as CFString, kCFBooleanFalse) | ||
| } | ||
|
|
||
| var point = CGPoint(x: frame.x, y: frame.y) | ||
| guard let pointValue = AXValueCreate(.cgPoint, &point) else { return false } |
There was a problem hiding this comment.
Re-enable AXEnhancedUserInterface on all early returns
After setting AXEnhancedUserInterface to false, the function can still return early through later guard failures, which skips the restore block and leaves the target app in the disabled state. This can happen when AX value creation fails (for example, if a computed frame is invalid/non-finite), so cleanup needs to run on every exit path (e.g., via defer) once the attribute has been toggled.
Useful? React with 👍 / 👎.
Instead of unconditionally restoring to true, read the app's existing value before disabling it and restore that exact value afterwards. Prevents permanently flipping the attribute for apps that had it explicitly set to false or unset. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Increase the "Almost Maximize" layout from 80% to 90% of the work area (both native Swift path and JS fallback). Also suppress the window resize animation for all window management commands by temporarily toggling AXEnhancedUserInterface off on the target app before setting bounds.