Repository navigation
Conversation
Reading focus for the first time resolves the main monitor's active workspace. Reconciliation therefore cannot use that getter to inspect existing focus: it may itself be running while activeWorkspace is being initialized. Keep the same first-read initialization in optional backing storage and expose a read that returns nil before initialization. Add a test-only monitor override and focus reset so display transitions and cold focus initialization can be exercised without NSScreen. Clear monitor mappings in workspace test setup to keep those fixtures isolated.
When a display disconnects, nearest-screen remapping can hide the focused workspace. This occurs when two old screens map to the same surviving screen, or a numeric monitor assignment resolves to a different screen after the display count changes. Capture the initialized focused workspace and its resolved destination before rebuilding the visible-workspace maps. After the existing remap, restore it only if it is hidden and that destination is still present. Other workspace mappings and force-assignment resolution stay unchanged. Do not initialize focus during reconciliation or restore visibility when there are no monitors. Add six tests covering a forced-assignment disconnect, a collision, focus that remains visible, cold initialization, moved monitor origins, and an empty monitor list. Reverting only this fix makes the disconnect and collision tests fail; the other four are regression guards. Validation: ./test.sh passed with the pinned Swift 6.4.0 toolchain. This includes the warnings-as-errors build, XCTest suite, CLI smoke checks, formatting, SwiftLint, Periphery, generation and clean-tree checks.
JuanRdBO
force-pushed
the
fix/focused-workspace-display-reconcile
branch
from
October 28, 2026 03:05
c6b9c63 to
7ed6f6b
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Keep the focused workspace visible when display remapping would otherwise hide it. The existing nearest-screen and force-assignment rules still determine its destination.
Six regression cases cover display changes and focus initialization. Two fail with the fix removed.
./test.shpasses with the pinned Swift 6.4.0 toolchain.PR checklist
./test.shexits with zero exit code.