# Restore the focused workspace after quitting \(\#58392\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/8b5db3582cded894d99a23bea0d4414cc627ac0e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 8b5db3582cded894d99a23bea0d4414cc627ac0e

Requested commit: 8b5db3582cded894d99a23bea0d4414cc627ac0e

Commit: 8b5db3582cded894d99a23bea0d4414cc627ac0e

Tree: 21274878ba21fbcae064a5f9ea1eb2e93ea1c06f

Author: Lukas Wirth

Committer: GitHub

## Message

```
Restore the focused workspace after quitting (#58392)

On quit, the handler activates every workspace in each window to surface
save prompts. Activating re-serializes the multi-workspace state, so the
persisted active_workspace_id ended up pointing at whichever workspace
was iterated last rather than the one the user had focused. On the next
launch the wrong (or empty) workspace was restored as active, even
though all projects still appeared in Open Recent.

Re-activate the originally-focused workspace after the close-prompt loop
(and on the cancel-quit path) so it is the one serialized as active.
Also harden read_serialized_multi_workspaces to prefer a workspace with
paths over a scratch/empty one when the persisted active workspace can't
be matched.

Release Notes:

- Fixed a workspace restoration issue where zed would restore a window
with none of its projects opened by default
```

## Parents

- [28bd200273ba02141a830f7a62ea278a4a4f692b](https://git.cafe/gitcafe/zed/commit/28bd200273ba02141a830f7a62ea278a4a4f692b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/8b5db3582cded894d99a23bea0d4414cc627ac0e?format=markdown)
