-
Notifications
You must be signed in to change notification settings - Fork 504
Description
Problem:
Some applications create windows that initially fail Amethyst's basic management criteria but become eligible for management shortly after window creation. Currently, these windows are never re-evaluated and remain unmanaged, preventing them from participating in tiling layouts.
Affected Applications:
- Photos (consistently reproducible for me, possibly because I have a large library so there is a brief delay in starting)
- Potentially other apps that have delayed window initialization
Steps to Reproduce:
- Start Amethyst with tiling enabled
- Launch Photos app
- Observe that the Photos window appears but is not managed by any layout
- The window remains floating despite meeting all management criteria once fully loaded
Technical Root Cause:
The issue occurs in the add(window:) method in WindowManager.swift:
Specifically, I traced this for Photos. Here window.shouldBeManaged() returns false initially because CGWindowsInfo.windowSpace(window) returns nil for newly created window in Photos.
This causes window change type to be .unknown instead of .add(window)
Current Behavior:
- Window gets processed once during creation
- If management criteria fail, window is permanently excluded
- No retry mechanism exists for delayed window initialization
Expected Behavior:
- Windows that become eligible for management shortly after creation should be automatically detected and managed
Suggested Solution:
Implement a retry mechanism in the window management system with these implementation considerations:
- Extend add(window:) method: Add retry parameters similar to the existing float determination retry logic
- Dual retry mechanisms: Separate retry logic for management criteria failures vs. space determination failures
- Exponential backoff timing: Use progressively longer delays (e.g., 10ms → 20ms → 40ms → 80ms → 160ms)
Environment:-
- macOS Version: 15.5
- Amethyst Version: 0.24.0