terminal icon indicating copy to clipboard operation
terminal copied to clipboard

New action `Restart this tab` in the tab's topbar context menu

Open vadimkantorov opened this issue 6 months ago • 14 comments

Description of the new feature

Image

This is useful when a tab is completely hung because of hung ssh session in a tab (e.g. happens when you have ssh connection, shut the laptop lid, then wake it up without wifi). In this state of ssh blocking in some I/O (under WSLv1 Ubuntu 24.04), the tab does not respond to any input, including Ctrl + Z and one has to wait for minutes until it prints client_loop: send disconnect: Connection reset by peer (I'll try using also the tilde commands, but they won't work for some other non-ssh I/O blocked tab anyways). If it's possible to also send some Linux signal into the tab (Ctrl+C or Ctrl+Z)

It is then useful to be able to restart this particular tab to not need to start a new one and then move it with a mouse to keep the tab order the same

Proposed technical implementation details

No response


Regarding Duplicate tab: currently the new duplicate tab gets placed at the right end of the topbar, not next to the duplicate tab. I would suggest that it the new tab should be placed right after the original one - just like in Chrome

vadimkantorov avatar May 10 '25 16:05 vadimkantorov

We should probably put it in the menu.

For now, you can get at it with the command palette under the name "restart connection".

DHowett avatar May 10 '25 22:05 DHowett

For Duplicate tab - also please consider creating the new tab right next to the old one (similar to Chrome) and not flushed to the right

And the other idea - is to be able to send some Linux signals (equivalent to Ctrl+C and Ctrl+Z) also directly from the context menu...

vadimkantorov avatar May 11 '25 07:05 vadimkantorov

It looks like there is already code there for it here

jamespack avatar May 26 '25 19:05 jamespack

Yea unless Im reading this wrong, this functionality already exists. If the current tab's connection IsClosed() it sets that menu Items Visibility to Visibile. Otherwise its Collapsed. Maybe there is a bug?

jamespack avatar May 26 '25 20:05 jamespack

Image

jamespack avatar May 26 '25 20:05 jamespack

Seems to work

Image

jamespack avatar May 26 '25 20:05 jamespack

I'm proposing to always make this menu item available. My usecase is that some program (like ssh) hangs the tab completely, and I'd like to be able forcibly restart the tab (basically kill the existing tab, and create a new tab with the same profile at the same place in the tab bar) - even if the Terminal does not detect the tab as "restartable"

"Restart connection" is also a super strange naming for this...

vadimkantorov avatar May 26 '25 21:05 vadimkantorov

@DHowett Whats your view on this?

jamespack avatar May 27 '25 23:05 jamespack

Please do feel free to add it to the menu. However: it is a destructive action; should we guard it as such?

DHowett avatar May 28 '25 00:05 DHowett

Yea I feel like this is a different use case. This is a process that is hung either on the remote session or possibly on the client side. It could be tricky to know which. Further, it could become a slippery slope to start killing processes. Id be hesitant to add a menu item that whose intention was to kill processes that we couldnt be 100% sure we knew was the culprit for the hung tab. Thats just my two pennies worth.

jamespack avatar May 28 '25 23:05 jamespack

I suppose at the end of the day if we know what process is responsible for the tab we can restart that process as the tab is useless at that point anyway.

jamespack avatar May 28 '25 23:05 jamespack

Do we even do that kind of book keeping?

jamespack avatar May 28 '25 23:05 jamespack

Well, there is already a "destructive" option to close the tab (and restart the tab when the user wishes so isn't much different) , so the bookkeeping should be somewhere...

vadimkantorov avatar May 29 '25 05:05 vadimkantorov

Sure just destroying and re-creating the tab would be fairly trivial (I think). Btw there is a setting currently available to always create new tabs next to the current tab instead of at the end of the tab row which is the default. Not sure if you were aware of that or not. That would solve at least part of this.

jamespack avatar Jun 16 '25 21:06 jamespack