Repository navigation
Reflow Todo mode when the display configuration changes - #1947
Conversation
Connecting or disconnecting a display, or changing an arrangement or a resolution, left the Todo window on the wrong display or at the wrong size until the user ran Reflow Todo or toggled Todo mode (rxhanson#764). TodoDisplayChangeReflow observes the screen-parameter notification, waits for the burst a reconfiguration posts to settle, and then runs the same reflow the Reflow Todo command performs, without bringing the Todo window forward. It does nothing while Todo mode is off and nothing for notifications that leave the layout as it was at the last reflow, while a display unplugged and plugged back in before the burst settles still counts as a change. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Keeps both sets of tests appended at the end of RectangleTests.swift: the adjacent-display tests from rxhanson#1937 and this branch's Todo reflow tests. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Great! The only awkward scenario left is that the empty sidebar space remains when the todo window goes back to a reconnected display, where it feels like the windows should go back to the edge of the screen in absence of the todo window. I'm ok without that being addressed at this time, though, as it would also be making an assumption that might not align with the user's intention. |
Keeps this branch's two test classes appended after the Todo reflow tests that rxhanson#1947 added at the end of RectangleTests.swift. Also restores the two closing braces at the end of NewWindowActionManagerTests that the merge of rxhanson#1945 into main dropped; without them the RectangleTests target does not compile on main. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Thanks! On the leftover sidebar space: I think the assumption problem can be avoided by only undoing Rectangle's own change. When the reflow shifts a window off the sidebar, it would remember the window's original frame. Later, when a reflow moves the Todo window to another display, it would restore those windows on the display it left, but only if the user hasn't moved or resized them since (the frame still matches what Rectangle set). Windows the user placed themselves, or touched afterwards, stay where they are. Would you be open to that? Two questions:
|
Closes #764
When you connect or disconnect a display, or change an arrangement or resolution, the Todo window tends to end up on the wrong display or at the wrong size, and the sidebar stays reserved, until you run Reflow Todo or toggle Todo mode off and on. You wrote on the issue that "it would make sense at the very least to trigger a reflow on display connect/disconnect"; this does that.
What changes
TodoDisplayChangeReflow, a small class in TodoManager.swift, observesNSApplication.didChangeScreenParametersNotification. A reconfiguration posts a burst of these, so it waits one second of quiet and then runsTodoManager.moveAllIfNeeded(false), the reflow the Reflow Todo command performs (it also shifts windows on the Todo display out of the sidebar, as that command does), without bringing the Todo window forward.moveAllIfNeededkeeps its existing guard. A disconnect is treated like any other change: if a display drops out for more than a second, Todo mode is laid out on the remaining display, and again when the display returns.WindowManagerchange.Tests
Six cases in
TodoDisplayChangeReflowTests, with the scheduler, layout and reflow injected: one reflow after a burst settles, no reflow for unchanged screen parameters, an unplug-and-replug within the burst still reflows, only a new layout reflows again, a layout that only differs once the burst has settled still reflows, and nothing is scheduled once the observer is released.The full
RectangleTestssuite passes: 659 tests, 0 failures, on macOS 27.0.1 / Xcode 27. I have not yet exercised it against a real display hot-plug on this Mac; happy to do so and report before merge if you would like.