Closed apricotbucket28 closed 1 month ago
I think this is partially a side effect of the difference between Mac (apps can be "open" but with no open windows) and Liunux/Windows (apps quit when the last window is closed).
The default for restore_on_startup
is last_session
which reopens all workspaces open when you quit, but none if you quit by closing the last workspace. While last_workspace
re-opens the most recent workspace, even if you explicitly closed the workspace instead of quitting.
There is some more discussion here, but this is definitely still in development:
Thanks for reporting @apricotbucket28 and thanks @notpeter for digging in.
Agree, I think we need to do something like I outlined here: https://github.com/zed-industries/zed/pull/14965#issuecomment-2263610500
I just hope we can come up with something that's less hacky than this.
Hi @mrnugget! IMHO the solution you came up with is fine, maybe the comment could be a bit more descriptive. Something like this:
// On Linux and Windows, closing the last window will also close the entire program
// See https://github.com/zed-industries/zed/issues/15642
#[cfg(not(target_os = "macos"))]
let quitting = quitting || cx.windows().len() == 1;
If you think it's fine I can open up a PR with the fix!
VSCode, for reference, seems to do the following:
Zed with the aforementioned fix matches VSCode's behaviour, except in the last case (an empty project opens instead, probably a different issue here)
Edit: There's actually a bug with this approach, replacing the current workspace in the current window will cause multiple workspaces to be opened again.
Second edit: So that implementation isn't correct, but that bug seems to exist in master
nevertheless.
Thanks @apricotbucket28!
Check for existing issues
Describe the bug / provide steps to reproduce it
When closing Zed and then reopening, sometimes the workspace won't be restored and an empty project will be opened instead.
Reproduction steps:
Interestingly, I found that the following setting fixes the issue:
Environment
Zed: v0.148.0 (Zed Nightly 3bd9a3f478337deb4d46a711d5a3d5c0e4627216) OS: Linux Wayland fedora 40 Memory: 30.5 GiB Architecture: x86_64 GPU: AMD Radeon RX 6700 XT (RADV NAVI22) || radv || Mesa 24.1.4
If applicable, add mockups / screenshots to help explain present your vision of the feature
No response
If applicable, attach your Zed.log file to this issue.
Zed.log