-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Prompt before closing pane with multiple client apps #6549
Comments
You know, I was going to just close this as a combo of #5301, #2976 and #5065. However, none of those cover this specific case, where we prevent closing a terminal tab/pane when there's more than one client in the process tree. We really don't have a comprehensive discussion of all these requirements anywhere, do we? Scenarios
Furthermore, we've only got one setting so far - |
@zadjii-msft I think your comment is covered with #2976 |
Okay yea, i should have been more specific. We want to enable settings to enable/disable the prompts for each of these scenarios. Just prompting before the user quits, regardless of the content, isn't something that I think most people want. Maybe it's gotta be a flag enum? enum ConfirmOnClose
{
Never = 0x0,
MultipleProcesses = 0x1,
MultiplePanes = 0x2,
MultipleTabs = 0x4,
Always = 0x8,
} I'm adding the |
@zadjii-msft I read your comment with the szenarios. What technicality means "multiple processes"? Does this means two panes where each of them is running a process (e. g. ssh connection)? |
"multiple processes" means that in any pane, there's more than just the immediately attached child running. So case in point would be launching It notably could mean one tab, one pane, but in that pane is multiple processes. |
@zadjii-msft |
Yea? In this case "multiple processes" === "on running processes/jobs". |
@zadjii-msft |
... nothing in particular? It's just what my inner monologue said when I read your comment 😄 |
So, you want |
Is it still active issue? #11335 Maybe simply hide [X] tab button option for some profiles(but keep context menu). Stateless apps will be happy when you'll can't close them by miss click |
Yea, it's active in the sense of "we'd like to get to this soon", we've just had other priorities in front of it. Basically, we need to take my comment above, turn it into a spec, get consensus on that, and then just do the work. The actual warning isn't hard, but making sure there's a set of unambiguous settings for all use cases is 😄 |
My current workaround for this is to always open two tabs, and that way I can get a confirmation whenever I'm closing a Terminal window. But having the ability to confirm on close when Neovim has unsaved work would be at the top of my wishlist for sure. |
Any chance this has been spec'd and / or is slated for kind of soon-ish? 😊 |
Unfortunately not. This keeps on treading water just below the cut line, unfortunately. I might be able to sneak the spec work in soon, but certainly won't have the cycles to do the dev work. |
Appreciate the update! Any progress is good progress if you are indeed able to sneak that spec work in! |
I find this specification too complex. I believe useful progress can be made by implementing the most critical case which is closing a tab that is in the middle of running some application. |
That's actually probably the hardest to implement, because currently the Terminal doesn't really track the whole process tree of things spawned by the Terminal. We'd have to do that first, and plumb that all through. Big-picture, when I'm writing specs, I find that it's usually best practice to enumerate all the related scenarios in a single doc. That way, designs for a single part won't conflict with the requirements for other related parts. Ultimately, I think that design ends up being pretty elegant for every possible scenario that we've been asked for. Just one setting that can cover all these use cases seems like best case scenario: // Just prompt always
"confirmOnClose": "always",
// Prompt on multiple processes, but not for multiple panes/tabs
"confirmOnClose": "multipleProcesses",
// combine flags
"confirmOnClose": ["multipleProcesses", "multiplePanes", "multipleTabs"] |
Does the the terminal "own" the X icons on tabs? Because my own case is mostly just that I accidentally close tabs when I mean to activate them, so if it that button could confirm instead of just killing, that would -- I think -- solve that part without needing to track down all spawned processes, etc. |
This close button without prompt is definitely for me the worst part of Windows terminal. I've use the workaround described in another issue to hide the X icons:
Full example: "themes":
[
{
"name": "dark NO CLOSE BUTTON",
"tab":
{
"background": "terminalBackground",
"iconStyle": "default",
"showCloseButton": "never",
"unfocusedBackground": "#00000000"
},
"tabRow":
{
"background": null,
"unfocusedBackground": "#333333FF"
},
"window":
{
"applicationTheme": "dark",
"experimental.rainbowFrame": false,
"frame": null,
"unfocusedFrame": null,
"useMica": false
}
}
] NB: I can now close tabs with CTRL+W or MiddleMouseButton. |
I just closed a tab that I had active work in as I had switched to another tab and wanted to go back... Most of my navigation is done with the keyboard and for my use case I never want to close a terminal tab with the mouse, never ever ever. I can type Ctrl-D or I would be satisfied enough with a "do you want to close" confirmation any time I hit the X but honestly I would prefer to have the X button just gone. I get what the above poster has done to create a theme without the close button but now I'd have to figure out how to clone my current theme... and this is not something that has anything to do with theming. (Why would a rando user want a theme to decide the behavior of the close button?) In my opinion the above matrix is way overwrought. There are three options for each of two settings and they are disjoint:
Sure, getting more complicated for things like looking at the process tree is all fine and good but for almost every single person commenting above it was, "I was trying to switch tabs and I closed it instead." That is what should be addressed and then worry about the rest. Another way to go would be to "never close a not-foreground tab", and maybe that's easiest... but the accidental tab closures are not limited to background tabs. (Personally, I find any application that allows you to mutate state with the mouse when it is not in focus to be terrifying because inevitably something is changed with a mouse click and you have no way to know what.) |
This can be implemented more easily once Windows Terminal is its own console server. Of course, that doesn't work for ssh, but that can't ever work. Always showing a confirmation message would be in line with how other terminals behave. |
Description of the new feature/enhancement
Some console apps, like vim, neovim, far, etc, are ignored when you accidentally hit Ctrl+W and your unsaved work is gone forever.
Proposed technical implementation details (optional)
I'm not sure how to do that, but it would be nice to offer an API or something to block closing if some return code is not met.
The text was updated successfully, but these errors were encountered: