Skip to content

Windows from certain applications (e.g., Photos) fail to be managed due to timing issues in window criteria evaluation #1795

@david-soloveichik

Description

@david-soloveichik

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:

  1. Start Amethyst with tiling enabled
  2. Launch Photos app
  3. Observe that the Photos window appears but is not managed by any layout
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions