microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.53k stars 8.18k forks source link

Support HTM (headless terminal multiplexer) for remote pane/tab management #5321

Open matt-kempster opened 4 years ago

matt-kempster commented 4 years ago

Description of the new feature/enhancement

As mentioned in #3656, it would be great to have tmux control mode support for Windows. More abstractly, it would be especially great if there was remote pane/tab management available at all, through any terminal multiplexer (not just tmux). In fact, @MisterTea's EternalTerminal has such a terminal multiplexer called "HTM" (headless terminal multiplexer). It is being adopted by Hyper.js (see https://github.com/zeit/hyper/pull/2988) and would seem to have a simpler client-side implementation than tmux control mode.

To be extra clear: I really want to be able to open a connection to a remote machine, then use Windows Terminal to split a pane in two, revealing two terminal inputs for the same remote machine - or use a new tab hotkey do to the same for a tab instead of a pane. It seems like HTM might be an easy way to go forward.

Proposed technical implementation details (optional)

I'm not sure. Maybe @MisterTea would have some ideas. But from a quick glance through the HTM source code, it would appear that one might start by parsing and interpreting its header codes.

MisterTea commented 4 years ago

The best way to see how to interact with HTM is to look at the Hyper.js client: https://github.com/MisterTea/hyper-htm/blob/master/index.js

At a high level, HTM lays out content like this:

  1. Array of tabs
  2. Each tab is a tree structure where the leaf nodes are terminals and the inner nodes are splits (e.g. a tab with a vertical split pane would have a split node with two terminal leafs)

In this way it's possible to make any hierarchy of panes in a tab. Each terminal is given a UUID so when data arrives on that UUID, it should be forwarded to that terminal.

I'm happy to help develop a plugin for windows terminal and answer any questions.

zadjii-msft commented 4 years ago

Sure, this seems reasonable was well. Added it to the list in #4000 (along with #3656) as possible types of extensions. Presumably they'd work as some type of enhanced ITerminalConnection object. Since we've already got a top-level list of tabs and a tree of panes underneath each tab, this seems like a natural fit.

DHowett-MSFT commented 4 years ago

The same infrastructure would support tmuxcc, so I hope we do get a spec out of it! :smile: