Skip to content

Conversation

@mchisolm0
Copy link
Contributor

Persist and restore window values (size, position, etc.) to the KV Store when there are no projects open.

Relates to Discussion #24228 (reply in thread)

Release Notes:

  • Added persistence for window size when no projects are open

Persist and restore window values (size, position, etc.) to the KV Store
when there are no projects open.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 13, 2025
@mchisolm0
Copy link
Contributor Author

Here is a video of the window size and position persisting when File > New Window is chosen (so no project is selected). I have confirmed it also works on MacOS when you completely quit and reopen the app.

Video demo
Demo.window.size.and.position.persist.without.project.mp4


/// Represents the status of how a window should be opened.
#[derive(Debug, Copy, Clone, PartialEq)]
#[derive(Debug, Copy, Clone, PartialEq, Deserialize, Serialize)]
Copy link
Contributor Author

@mchisolm0 mchisolm0 Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ConradIrwin I did have a question when you have time. I will also set up a time to pair. In my current version, I added Deserialize, Serialize to the WindowBounds enum.

Is there a better way for me to structure the feature so I can avoid changing WindowBounds?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The disadvantage of adding Serialize/Deserialize here is that we can never change this structure without breaking serialization. Although it's a bit of extra code (though hopefully nothing beyond what AI can build) it's less likely that we'll break things in the future if we have a specific structure/enum in the serialization code that gets converted to this (maybe we can copy the existing stuff from workspace? though tbh storing a JSON blob seems better than destructuring to a bunch of columns).

Not a huge issue though, so we could leave this and then deal with it when we want to change this enum.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we want to consider that, I have another version of the PR here #44937. I have run it and it also works.

I still have not tried for a remote workspace. Maybe I can try that tomorrow or later this week.

@ConradIrwin
Copy link
Member

@mchisolm0 One question:

  • Currently workspace has fallback code to try and find the last opened workspaces dimensions. Intuitively it might be clearer if that used this set of dimensions too (instead of "last opened workspace"). Does that make sense?

Switch remote workspace without a project to fallback to window bounds
stored in the KV store like local workspaces now do.
let (display, window_bounds) = DB.last_window().log_err()?;
Some((display?, window_bounds?))
});
.or_else(|| persistence::read_no_project_window_bounds());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ConradIrwin Is this where you meant by

instead of "last opened workspace"

I have not used opening remote workspaces yet, so I have not tested it beyond making sure Zed still builds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants