Skip to content

feat: task windows open at exit come back where they were - #880

Merged
petre-c merged 2 commits into
mainfrom
task-windows-reopen
Dec 1, 2026
Merged

petre-c merged 2 commits into
mainfrom
task-windows-reopen

Conversation

@petre-c

@petre-c petre-c commented Dec 1, 2026

Copy link
Copy Markdown

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.OpenTaskWindows lists every open task window with its rectangle, its workspace and whether it was minimized. WorkspaceManager.SaveOpenTaskWindows writes it, and skips the write when nothing changed.
  • TasksBoard updates 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. Shutdown takes the list one last time, and the closes that follow leave it alone.
  • TasksBoard.RestoreWindows runs 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.BringTaskWindowHere takes raise: false for 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.
  • Asking which desktop a window is on goes through a COM call that pumps messages. So RememberOpenWindows works 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

  • New: 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 in JsonPersistenceStoreTests.
  • Core: 6057 passed. Windows, on the hidden desktop: the 611 task board and task window tests pass. An earlier full run passed 2414 before the hidden desktop's heap ran out; its only failures were the two known ClaudeSkillTests that fail in a background session.
  • Release build with -warnaserror is clean.

Release notes

  • Task windows you leave open come back when Deskbar starts again, each where it was and on its workspace, minimized if it was. They open without taking the keyboard from what you are working in. A window you closed yourself, or whose task you deleted, does not come back.

opus5

Petre Chitashvili 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*
@petre-c
petre-c merged commit 1f711c6 into main Dec 1, 2026
3 checks passed
@petre-c
petre-c deleted the task-windows-reopen branch December 1, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant