-
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
Read-only session mode to prevent accidentally killing a long-lived process #6981
Comments
This seems related to pinning tabs (#5969) but here I don't care about automatically restarting the long-lived processes, as the work would have been lost already. |
You know what, I actually like this idea. Locked sessions or something. |
#6372 is another feature request for long-lived noninteractive processes. These could be useful together but I don't think the implementations would have anything in common. |
@DHowett, @zadjii-msft - I have a PoC. Still not pushing as it is pretty dirty and doesn't handle all scenarios. Please let me know if UX makes sense: |
wow holy crap. That's like, the whole thing! I think the only thing I'm not positive on is the "If you try to close the window while one pane is read-only, we close all the non-read-only tabs, then prompt for the closing of the read-only pane". You know what, I've watched this gif like 8 times while typing this up and I think it's great as it is. I guess in my head I was trying to reconcile that warning with all the scenarios from #6549 - in all those I was still expecting only one dialog. This scenario though kinda necessitates a secondary dialog just for closing the read-only pane, regardless of the Lemme cycle this through to the team and see if they have other feedback 😄. |
I wonder if ShutdownBlockReasonCreate would make sense here. Perhaps not, if the user has an SSH connection in the Windows Terminal session and runs |
@KalleOlaviNiemitalo Probably not, since there's not a reliable way for a client application to get at the HWND of the Terminal (and we're not about to provide one either). You've called out the exact reason why - it's not going to make sense in ssh sessions, or sessions where the Windows Terminal isn't the end terminal application. So I'd rather not open a door that's not going to work 90% of the time. |
I meant Windows Terminal itself could call ShutdownBlockReasonCreate when the user enables read-only mode in a session. On the basis that, if the user does not want to terminate processes in the session by closing a tab in Windows Terminal, then the user probably does not want to terminate them by shutting down Windows, either. In the ssh + tmux scenario though, closing the tab or shutting down Windows is not really a problem because the remote tmux session can be resumed later, but read-only mode can still be useful for blocking Ctrl+C. |
Very good idea. Count me in as a tester whenever there's code that implements this. |
Good thing, because there's a PR for it already: See #8867 |
What would be the right route to help testing this? Wait until #8867 gets merged in? |
I mean, you could wait if you want. If you're ambitious, you could always check out the PR and build it locally. I usually do that with a commandline like:
|
@KalleOlaviNiemitalo - Right now I moved forward without invoking
If you like the idea, probably we can create a follow up task. |
(I'm in love with this feature. It's so cool.) |
@Don-Vito I think it's best not to call ShutdownBlockReasonCreate now. Minimize the risk of surprising effects. (I assume ShutdownBlockReasonCreate has no effect on whether Microsoft Store can forcefully terminate the app to install updates.) |
## Summary of the Pull Request Introduces read-only panes. When pane is marked as read-only: 1. Attempt to provide user input results in a warning 2. Attempt to close pane - shows dialog 3. Attempt to close hosting tab shows dialog 4. The hosting tab has no close button ## PR Checklist * [x] Closes #6981 * [x] CLA signed. * [ ] Tests added/passed * [ ] Documentation updated - not yet. * [x] Schema updated. * [ ] I've discussed this with core contributors already. ## Detailed Description of the Pull Request / Additional comments 1. The readonly logic implemented in `TermControl` (and prevents any send input) 2. Special handling is required to allow key-bindings 3. The "close-readonly" protections are in TerminalPage. 4. The indication that the pane is readonly is done using lock glyph 5. The indication that the tab contains readonly pane is done by hiding the close button of the tab 6. The readonly mode is enabled by keyboard shortcut (the followup might add this to the context menu) ## Validation Steps Performed
🎉This issue was addressed in #8867, which has now been successfully released as Handy links: |
Description of the new feature/enhancement
I sometimes run
ROBOCOPY
or another long-lived process in Windows Terminal. I then fear that I might accidentally close the tab or hit Ctrl+C and have to start over. I would like to mark the session or tab as protected (important and read-only) and have Windows Terminal protect me from such mistakes.I already mark such tabs with a distinctive color but they still feel risky.
Proposed technical implementation details (optional)
Add a "Read only" check box to the per-tab menu. When the check box is checked:
There could be a key-bindable action to turn the read-only mode on and off.
The text was updated successfully, but these errors were encountered: