Repository navigation
New windows go first in the bar, not last - #111
grub-basket wants to merge 4 commits into
Conversation
Reported on a device: a new window's thumbnail landed at the right end of the bar; the start is where a window just opened is wanted (and the end of a long bar is off screen). WindowCatalog kept first-seen order and appended newcomers; it now puts newcomers first and keeps the rest in first-seen order. A device that never rearranged its bar shows the host's order, so this is what it sees. A device that did rearrange lists its arrangement first and every other window after it (StreamClient.orderedWindows), so on such a device a new window still lands after the arranged ones until the iOS app changes too. Tested: swift build -c release. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bar too Reported on a device: a new window's thumbnail lands at the right end. StreamClient.orderedWindows lists the device's own arrangement first and every window it does not hold after it, so once a bar was rearranged, a new window always went to the far end, whatever order the Mac sent. On a window list from the same Mac in the same session, the windows it adds (not in the last list, not in the arrangement) are put at the start of windowOrder, in the Mac's order, and the arrangement is saved. The first list of a session and a list from another Mac add nothing: everything in them would read as new. A bar never rearranged (windowOrder empty) is untouched; it shows the Mac's order, which puts new windows first since the catalog commit before this one. Tested: the iOS app type-checks in a scratch copy with DuoPostureReader's iOS 27.1 calls stubbed (this Mac has only the iOS 27.0 SDK). Not run on a device or a simulator. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
From a pass over all the open pull requests (nothing is decided yet): #66 (and #72 and #73, built on it) adds windows from other Spaces and minimized windows to the catalog, which this rule would count as new and put first on every device, and its Mac viewer compiles |
Review of Saffsanity#111 (the repository owner): Saffsanity#66, and Saffsanity#72 and Saffsanity#73 built on it, add windows from other Spaces and minimized windows to the catalog, so a window can leave the list and come back. The first version of this pull request counted it as new each time: the host dropped a window from its first-seen order when it left and put it first again when it came back, and the device compared each list only with the one before. Every switch of Space or every minimize would have moved windows to the front, on every device, and on Saffsanity#66's Mac viewer too (which compiles StreamClient.swift). - WindowOrder (Sources/StreamProtocol, pure, shared by both ends): seen() is the host's first-seen order: windows never listed before first, in the order listed, then every window seen before, gone ones included, so one that comes back takes its old place; past a cap the windows gone the longest are forgotten, never one listed now. arranged() is a device's arrangement after a list: windows this session has never seen, and the arrangement does not hold, go first; nothing on an unarranged bar or on the session's first list. - WindowCatalog keeps every window it has listed (seenCap 1024) and orders by WindowOrder.seen. - StreamClient keeps every window id this session's lists named (seenWindowIDs; cleared at tearDown and when the Mac changes) and takes WindowOrder.arranged's result, saving it. Tests/checks/window-order: 14 checks, 10 of 10 mutants caught; README and CI's mutants matrix. Tested: swift build -c release; the check and its mutants; the iOS app type-checks in a scratch copy with DuoPostureReader's iOS 27.1 calls stubbed (this Mac has the iOS 27.0 SDK only). Not run on a device. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, good catch. Pushed 3430c04: a window now counts as new only the first time it's listed, and one that leaves and comes back (minimized, another Space) takes its old place.
|
# Conflicts: # .github/workflows/ci.yml # Tests/checks/README.md
|
Merged main in (b72a681), with no rebase. The only conflicts were list entries: CI's mutants matrix and the README rows ( |
What happens
When a new window opens on the Mac (iTerm's New Window, an app's second document window), its thumbnail lands at the right end of the bar. That's the end most likely to be off screen, and a window just opened is usually the one wanted next.
Why
WindowCatalog.refreshWindowskeeps first-seen order and appends newcomers.StreamClient.orderedWindowslists the device's arrangement first and every window it doesn't hold after it. So a new window went to the far end whatever order the Mac sent.The change
Two commits:
WindowCatalog.swift): newcomers go first, and the rest keep their first-seen order. A device that never rearranged its bar shows this order directly.StreamClient.swift): on a window list from the same Mac in the same session, windows that weren't in the last list or in the arrangement are put at the start ofwindowOrder, in the Mac's order, and the arrangement is saved.A setting ("New windows: first / last") could follow if you'd like one. I left it out to keep this small.
Tests
swift build -c release.DuoPostureReader's iOS 27.1 calls stubbed out.refreshWindowsor the window-list handler. I'm happy to pull the ordering rule out into a checked function if you'd prefer that.🤖 Generated with Claude Code