-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to Automatically Close Window on Last Tab Closed #13477
Comments
Here's how you configure this for other editors (source):
Edit: Zed has the same:
|
That's not the problem. You already have a I've got in my gitconfig
It waits fine. It works fine. The process closes when I close the tab, as you'd want for a git EDITOR. That all works fine. The problem is just I'm left with this empty window afterwards. Update: Reworded my original ticket a little to hopefully make the issue clearer. |
Gotcha. When launched via |
I assume adding an option is still considered? Because the solution mentioned by @notpeter only works in this specific situation; Personally i'd prefer a config option, so it works in all situations. |
@notDavid I think that's reasonable. VSCode has it as p.s. nice username |
I think the editor should go back to the terminal as well, as soon as the newly created buffer is saved and closed. The usual workflow, at least for me, is
So when the last pane in the active window closes, Zed should also close the current window and then return the application focus back to the calling application (even should there exist other zed windows). This might even make sense to have as a command line option. |
My gut feeling is that the default behavior should be:
And then As for returning focus to the calling application, I have no idea how to do this when there is an existing workspace open. My current workaround is to use Zed stable for my commit messages and Zed Preview for everything else, but I understand that is generally impractical. VSCode does not support this behavior. If you open SublimeText on the other hand is out there making us all look bad and is somehow how returning focus to the Terminal window from whence it was spawned, even when it has other projects open. I'm not positive how this works -- perhaps it walks up the process parentage until it finds a GUI app to which it can redirect focus? I have no idea. But now I want this for Zed. Thanks for raising the bar @neur0manc. Unless someone has a POC of how to do that, I would consider it out of scope for this issue -- we can create a dedicated enhancement request if the rest of this is implemented without that. |
@notpeter I'm not at all eloquent in Rust but I have a lot of time on my hands, so I'd at least take a look. Do you have an idea where in the codebase this would have to be implemented? I also want so this for Zed :) Also I just think it is nice that discussion has not been automatically closed by a stalebot ❤ EDIT: Diving into https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#birds-eye-view-of-zed , should clear up a thing or two. |
Look here: zed/crates/workspace/src/pane.rs Lines 1211 to 1218 in 2e7a89c
|
FYI, there is a setting that controls this at all times: // Whether the window should be closed when using 'close active item' on a window with no tabs.
// May take 3 values:
// 1. Use the current platform's convention
// "when_closing_with_no_tabs": "platform_default"
// 2. Always close the window:
// "when_closing_with_no_tabs": "close_window",
// 3. Never close the window
// "when_closing_with_no_tabs": "keep_window_open",
"when_closing_with_no_tabs": "platform_default", with |
@mikayla-maki Related, but slightly different, I don't know whether we would need to store some additional state whether we were started via wait to facilitate that check, perhaps added to OpenOptions: zed/crates/workspace/src/workspace.rs Lines 5956 to 5960 in 2e7a89c
When it's created in open_local_workspace: zed/crates/zed/src/zed/open_listener.rs Lines 408 to 411 in 2e7a89c
|
Ahhh I see, sorry I forgot how it worked 😅 . Thanks for the clarification @notpeter |
I'm interested too for that feature / enhancement. |
Check for existing issues
Describe the feature
So I have Zed set as my
git
EDITOR, explicitlyzed -n --wait
When I run
$ git commit
or$ git rebase -i
or such it pops open Zed.I'd really like an option for a window with no open tabs and no open directory to auto-close.
When I save and close the window with
CMD+S, CMD-W
though I am left with this little window with nothing going onIt'd be great if the whole window just closed. I could see this being a configurable option.
The text was updated successfully, but these errors were encountered: