Repository navigation
feat: task windows open at exit come back where they were - #880
Merged
Merged
Conversation
added 2 commits
December 1, 2026 19:35
Deskbar task de17bc89: "open tasks should return to their places after deskbar is restarted". The open task windows are listed in AppState.OpenTaskWindows, each with its own place, minimized flag and workspace. The board keeps the list as windows open, move and close, writes it whole at Shutdown before they close, and RestoreWindows reopens them at start without a switch, the keyboard or a raise. *opus5*
Review of Deskbar task de17bc89. The list was built lazily across a COM call that pumps messages, so an open or Shutdown inside the pump could throw or save a stale list. The windows are copied first, closed ones are left out at the end, a pass that finds the app shutting down saves nothing, and a nested request reruns the pass. The list is taken again once a new window has been put on its workspace. An unreadable tasks.json no longer wipes the list at start. The restore test uses rectangles above the window's minimum size at 150% scaling. *opus5*
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.
Deskbar task de17bc89
Task windows that are open when Deskbar exits now open again at the next start, each at its own place and on its own workspace.
What changed
AppState.OpenTaskWindowslists every open task window with its rectangle, its workspace and whether it was minimized.WorkspaceManager.SaveOpenTaskWindowswrites it, and skips the write when nothing changed.TasksBoardupdates the list when a window opens, moves, is minimized or is closed by hand. It takes the list again once the App has moved a new window to its workspace, because before that the workspace can read wrong.Shutdowntakes the list one last time, and the closes that follow leave it alone.TasksBoard.RestoreWindowsruns at start, after the workspaces are restored. It reopens each listed window whose task still exists, at its saved rectangle, minimized if it was, and puts it on its saved workspace when that workspace still exists. Restored windows do not take the keyboard. A tasks.json that could not be read leaves the list as it was, so one bad start does not lose it.App.BringTaskWindowHeretakesraise: falsefor these windows. It only moves the window: no switch, no activation, and none of the extra raises a quiet open does. A window shown on the desktop in front still lands on top there, as any new window does.RememberOpenWindowsworks from a copy of the window list, guards against running inside itself, and saves nothing if a shutdown or restore started in the meantime. A review of the first version found these cases.Known limits: a window that was maximized and then minimized comes back minimized, and a restore then gives it normal size. At sign-out the desktop service may not answer, so a window keeps the workspace it was last recorded on.
Tests
TasksBoardTests.ReopenWindows.cs(listed at shutdown, closed by hand not listed, each window at its own place, a start reopens at the saved places and drops deleted tasks) and a save/load test inJsonPersistenceStoreTests.-warnaserroris clean.Release notes
opus5