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

Restarting dead panes with the same command #2080

Open
ipkiss42 opened this issue Jun 6, 2022 · 2 comments
Open

Restarting dead panes with the same command #2080

ipkiss42 opened this issue Jun 6, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@ipkiss42
Copy link

ipkiss42 commented Jun 6, 2022

Is your feature request related to a problem? Please describe.
I started using Wezterm on Windows, to connect to a couple of remote hosts via SSH. For now I have one tab per host, with a single pane in each (I attach remote tmux sessions). After the connection is lost, panes are "dead": I can see the previous output (thanks to the CloseOnCleanExit behavior), but panes are inactive. So far so good.

The problem is to reconnect: new connections insist on using new tabs. This is annoying because:

  • I have to close the dead panes manually.
  • New tabs are created at the end, which messes with the ordering of the tabs (and thus I cannot rely on using ctrl-shift-N to always jump to the same tab).

Describe the solution you'd like
I would like a simple way to restart a dead pane, i.e. reuse the same pane and re-run the program that was previously run in it.

This could be achieved via a new action which I can bind to a key. If the pane is not dead, the action would not do anything or would show a warning.

There could also be a button on dead panes to allow 1-click reuse.

Describe alternatives you've considered
Current workaround described above.

Additional context
N/A.

@ipkiss42 ipkiss42 added the enhancement New feature or request label Jun 6, 2022
@bew
Copy link
Contributor

bew commented Jun 6, 2022

100% agree, note: I mentioned something like this in #580.
Both issues need the same initial plumbing, allowing actions after a pane is dead.
Once this is available (it's currently not AFAIK), both should be ~easy to implement I think.

I'd be great if it worked with wezterm ssh ... invocation as well, if it could restart the ssh connection.
(there is no 'same command to restart' in this case, it's internal)

@MuhammedZakir
Copy link
Contributor

There is a hacky way to "restart a tab" if you only want this for pre-defined commands and presuming the pane is not automically closed:

  1. When the current pane is dead, create a new pane in current tab.
  2. Run the command in new pane.
  3. Close the old pane.

If you want this to work with arbitrary commands, you will have to use user vars [1] to set/get the executed command. However, I am not sure if you can "get" it after the pane is dead (but before it's closed).

[1] https://wezfurlong.org/wezterm/config/lua/pane/get_user_vars.html

(2) Multiple actions with a single key press: https://wezfurlong.org/wezterm/config/lua/keyassignment/Multiple.html
(3) Useful if there are multiple panes in a tab: https://wezfurlong.org/wezterm/config/lua/TabInformation.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants