Skip to content
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

Confirmation before quitting #280

Closed
JoyceBabu opened this issue Sep 27, 2020 · 6 comments
Closed

Confirmation before quitting #280

JoyceBabu opened this issue Sep 27, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@JoyceBabu
Copy link

JoyceBabu commented Sep 27, 2020

Is your feature request related to a problem? Please describe.
I have configured wezterm to quit on CMD+q. But I pressed the combination by mistake, when trying to press CMD+1 for activating the first tab, and the window got closed immediately.

Describe the solution you'd like
Display a confirmation dialog before quitting.

iTerm allows configuring a list of programs (shell and tmux by default). If another program is running, then iTerm asks for user confirmation before quitting.

Describe alternatives you've considered
Another solution is to change the shortcut to a key combination that cannot be pressed by accident. But it is convenient to configure it as per the convention followed by other applications.

@JoyceBabu JoyceBabu added the enhancement New feature or request label Sep 27, 2020
wez added a commit that referenced this issue Oct 2, 2020
When confirmation is enabled, a really basic overlay is
rendered over the top of the pane to request confirmation.

```lua
 action=wezterm.action{CloseCurrentPane={confirm=true}}

 action=wezterm.action{CloseCurrentPane={confirm=false}}
```

refs: #157
refs: #280
wez added a commit that referenced this issue Oct 2, 2020
When confirmation is enabled, a really basic overlay is
rendered over the top of the tab to request confirmation.

The default key assignment for CloseCurrentTab now
has confirmation enabled.

```lua
action=wezterm.action{CloseCurrentTab={confirm=true}}

action=wezterm.action{CloseCurrentTab={confirm=false}}
```

refs: #157
refs: #280
@bew
Copy link
Sponsor Contributor

bew commented Nov 25, 2020

@wez this is done (in b2911cc) and can be closed?

Maybe @JoyceBabu you can try the latest release?
Update your config with action=wezterm.action{CloseCurrentTab={confirm=true}} for CMD-t and see if it works for you?

@wez
Copy link
Owner

wez commented Nov 25, 2020

We don't have an overall confirm to quit the app option, or one for closing a window, so this isn't quite done.

@JoyceBabu
Copy link
Author

@bew As mentioned above, the feature request was for confirming the app exit action.

There was a mistake in the original post. I had configured CMD-q, not CMD-t, to quit wezterm.

wez added a commit that referenced this issue Dec 23, 2020
Make pane, tab, window close confirmations use the same core function.

Make that function accept mouse input so that closing the window with
a mouse click doesn't require switching to the keyboard to confirm
the close.

refs: #280
@wez
Copy link
Owner

wez commented Dec 23, 2020

I added window close confirmation to master (in 5787bdf); that'll show up in the nightly downloads in the next hour or so.

I'm on Linux at the moment so I didn't have an opportunity to test what happens with CMD-q; it's possible that that will trigger normal window closing and thus the new confirmation logic. I'll try this out when I open up my mac a bit later today, but if you beat me to it, please let me know if that's sufficient to call this issue done!

@JoyceBabu
Copy link
Author

@wez Pressing ⌘+q displayed the confirmation prompt. But selecting yes closes only the current window, not the entire app.

wez added a commit that referenced this issue Dec 26, 2020
@wez wez closed this as completed in 586d18c Dec 26, 2020
wez added a commit that referenced this issue Feb 27, 2021
This is defined as a trait method on Pane (default: false), and has the
obvious transitive equivalent methods in Tab and Window (eg: if all
contained items are `can_close_without_prompting`, then that container
is also `can_close_without_prompting`).

The intent is to avoid bothering the user to confirm closing a window
when the content is not stateful and doesn't warrant it.

For example: the window that is displayed in the event of a
configuration error really shouldn't prompt to the user to confirm
closing it.

All termwiztermtab panes are `can_close_without_prompting==true`
to effect this policy.

In the future, we could teach LocalPane to lookup the session leader
process against a list of "uninteresting" or "stateless" processes
and return an appropriate result (as suggested in
#280).  That functionality
is NOT part of this commit.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants