Skip to content

fix(floating): open new floating windows on the display in use - #297

Merged
qeude merged 1 commit into
mainfrom
fix/floating-windows-open-on-focused-display
Nov 15, 2026
Merged

qeude merged 1 commit into
mainfrom
fix/floating-windows-open-on-focused-display

Conversation

@qeude

@qeude qeude commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Fixes #278

Summary

A floating window the app in use opens now appears on the focused monitor instead of where the app last left it (Finder's Settings after Command-comma, a palette, an inspector).

 reconcileWindows(activeMonitorID:)
   discoverWindow
     monitor = transient owner
           ?? rule location / rule monitor
+          ?? active monitor   # floating, app in use, opened now, app reaches that monitor
           ?? observed monitor
 Daemon.synchronizeDesktop
-  rebase floating frame only when a rule moved it
+  rebase floating frame when a rule or the active monitor moved it
 updateFloatingWindowFrames
+  once the move lands, accept the app's size (Finder grows Settings by 3 pt after the move)
  • Opened now means a window ID above the session's latestWindowID watermark (persisted with the topology), so windows already open at startup, after a restart, or returning from minimize or hide stay where they are.
  • The app reaches the monitor: a window joins the active monitor only if the app already has a window there, or has no other windows. A lone AXFloatingWindow palette stays put, so it never shows before its document and then follows it back.
  • The frame rebase also follows new transients that the runtime already sent to their owner's display, which it never moved before.
  • No monitor is chosen while another app's native fullscreen Space covers the active monitor.

Out of scope: the window still shows briefly on its old display (about 250 ms in the VM) before the move. That time is the app's Accessibility latency: Finder exposes the window about 160–220 ms after WindowServer draws it, and an earlier read sees nothing (measured in the VM).

Evidence

  • Before: on main, in the two-display defi-e2e VM, Command-comma with focus on display 2 opens Finder Settings on display 1. The new tests fail on main:
    • WindowLifecycleTests "Only a floating window the app in use opens appears on the active monitor"
    • DaemonDesktopSynchronizationTests.newFloatingWindowOpensOnTheActiveDisplay, whose last step (the app grows the window after the move) also caught a resubmit loop: 16 frame writes every 250 ms.
  • After: the same VM run puts Settings on display 2 with one frame submit. Both tests pass, and make verify passes.

Proved with the failing-then-passing unit tests and a recorded before/after run of the real daemon in the two-display VM.

Merge Danger

Door: two-way

Blast Radius: floating-window placement

Only new floating windows of the frontmost app on a multi-display desk are affected. A wrong guess places a floating window on the other display, and the user can move it back. The latestWindowID key is optional in the stored topology, so older stores decode.

Reviewed with review-loop: 1 round with Claude Opus 5.5. Verdict: approved

Note

Fix floating-window placement to use the active monitor

  • New floating windows now open on the monitor in use, instead of the app's previous monitor. Selection happens in DaemonDesktopSynchronization.swift and WindowReconciliation.swift.
  • Placement uses the active monitor only for new windows from the frontmost app, and only when that app already has another window on the active monitor (via the new applicationReaches helper). The active monitor is skipped when it holds a native-fullscreen window.
  • Windows moved across displays are tracked in the new Daemon.displayMovedFloatingWindowIDs set. Once a moved window lands within 2 points of its target, Daemon.updateFloatingWindowFrames adopts the app-reported frame (including its size) and clears the marker.
  • RuntimeState and WorkspaceTopology now carry latestWindowID so reconciliation can tell newly discovered windows from previously observed ones. Config docs in CONFIGURATION.md describe the new behavior.
  • Behavioral Change: floating windows may now appear on a different monitor than before; windows with the AXFloatingWindow subrole and no app siblings never use active-monitor placement.

Macroscope summarized aea72ad.

An app reopening a floating window where it last left it (Finder's
Settings, a palette) now shows it on the display the user works on.
Discovery places a floating window the app in use just opened on the
active monitor, a lone palette stays with its document, and the daemon
rebases its frame once and accepts the size the app gives it after the
move, so no frame write repeats.

Fixes #278
@github-actions github-actions Bot added the macroscope-review Request a Macroscope review label Nov 15, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 15, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at aea72ad

Macroscope's review found this PR approvable — New floating windows follow the display in use while preserving explicit rules, owner placement, and restoration safeguards. The impact is limited to recoverable window placement and sizing, with regression tests and a reported two-display exercise.

Notes:

  • Macroscope's correctness review did not run, so approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

@qeude
qeude merged commit b39caa1 into main Nov 15, 2026
5 checks passed
@qeude
qeude deleted the fix/floating-windows-open-on-focused-display branch November 15, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Request a Macroscope review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Open new floating windows on the focused display (not wherever the app last left them)

1 participant