-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Add support for Headless Terminal Multiplexer (htm) #2988
Conversation
Can you create a new one with only your changes by pulling the latest version? 90k line of addition if very difficult to track. @chabou What's your take on this? |
@ppot Sorry about that: it was using the canary as the base instead of master. |
Really cool! However I think this is better suited as a plugin, since it's not a thing that will be used by even 1% of hyper users, I think most of the stuff you're doing is already possible from a plugin, and if we need to expose more API for you to be able to pull it off I think that's a better way to do it than to integrate this deeply into hyper itself. Thoughts? |
@albinekb Sure, I'm fine with making it a plugin, but we will need to make some core changes either way. I'll see how much I can move over. |
@chabou what do you think? |
@albinekb So I started looking into it. Most of the logic can go into a plugin. The hardest part is the code in window.js. I have a new type of Session class that doesn't open a pty but instead forwards all the keystrokes to the session that's running htm. I may change that from Session/HtmSession to PtySession/DummySession and make the DummySession go through RPC to send/receive data. |
Awesome to hear, yes, that sounds like a plan that could support more other interesting plugins too! 👍 see my comment here as to why we want as much as possible in a plugin 🙏 |
@albinekb Alright, I've moved as much as I can out to a plugin: https://github.com/MisterTea/hyper-htm Overall, the core changes remaining can be described as follows:
I'm leaving the WIP tag on because I still need to test more edge cases and also replace iTerm with this on my own machines and use it for a few days. In the meantime it would be great to get feedback. |
I changed the logic so initSession is now a function inside the window class, and this way the plugin can override it. With this change, the FollowerSession logic can move entirely into the plugin and the overall change to hyper.js becomes pretty small. |
@albinekb I just realized that active development is happening on the canary branch, not the master branch. I have a branch in my fork called "htmcanary" that is the same changes rebased on the canary branch. Should I open a new PR with that branch? |
Yes please 🙏 Sorry for not noticing 🙈 @MisterTea |
Moved to #3026 |
As discussed in #2406 and #2978 , a terminal multiplexer that integrates with the terminal emulator would be a great addition to Hyper.js. I initially looked into integrating the existing solution, tmux control center, but tmux -CC has no defined spec and is difficult to reverse engineer. As a result, I wrote my own headless terminal multiplexer called HTM. HTM will be packaged with the next version of Eternal Terminal ( https://mistertea.github.io/EternalTerminal/ ).
The core idea is that htm runs inside of ssh/et and sends commands to Hyper.js (or any other terminal emulator). Hyper.js gets a special ANSI escape sequence which puts hyper in HTM mode, and then the current state of the tabs/panes. As users make tabs, delete tabs, or type in panes, all of this is funneled through htm. If someone exits hyper.js and comes back, running htm restores the state when the person exited. To see a demo of how this works, check out https://www.youtube.com/watch?v=Ea6Y08tP-RI&feature=youtu.be
This PR is a WIP because I assume it's a big enough change that it will require more iterations before it's ready to merge. It's 100% functional and can be tried by following these instructions: