Skip to content

Hyper Sessions restoration #945

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

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open

Hyper Sessions restoration #945

wants to merge 13 commits into from

Conversation

ppot
Copy link
Contributor

@ppot ppot commented Oct 30, 2016

Working on this again

Iteration circle into multiple PR.
Closes Issues #785, #567

Provide

app quit and process quit -> state restoration after shutdown / restart

This PR includes important changes in order to allow sessions record and restoration.

Concern

At the moment, the session is not affiliated to any opened tabs or splits in the win object. Sessions are created and then added to the sessions map in the win object so each win inside the windowsSet has multiples session.

Update

  • Add win folder
  • Add window object extanding BrowserWindow
  • window now have a Set of Tab
  • Tab now include a root Pane and each pane have childs

Apply hyper

Record

  • periodically save state
  • record all windows positions and sizes
  • record windows opened tabs
  • record tab root Pane and childs
  • record each Pane session cwd

Restoration

  • restore windows
  • restore windows tabs
  • restore tab Pane and child
  • restore Pane session cwd

This way, we can record the windowSet object and apply the restoration on restart and reload the precedent recorded state.
hyper_restore

@ppot ppot changed the title Hyper record Add session record and restoration for quit and unexpected quit Oct 31, 2016
@matheuss matheuss added this to the v1.0.0 milestone Nov 6, 2016
@matheuss matheuss self-assigned this Nov 6, 2016
@ppot ppot force-pushed the hyper_record branch 2 times, most recently from 7bf0333 to 3706c36 Compare November 10, 2016 03:01
@ppot ppot changed the title Add session record and restoration for quit and unexpected quit [WIP] Add session record and restoration for quit and unexpected quit -- bugs fixing Nov 10, 2016
@ivands
Copy link

ivands commented Nov 15, 2016

+1 please add this fast ;D

@ppot
Copy link
Contributor Author

ppot commented Nov 16, 2016

@ivands Still have a few glitch! But working on it!

@ppot ppot force-pushed the hyper_record branch 3 times, most recently from d78027b to c7defe2 Compare November 19, 2016 22:16
@ppot ppot force-pushed the hyper_record branch 3 times, most recently from 10c65c6 to 60dc986 Compare November 26, 2016 03:27
@ppot ppot changed the title [WIP] Add session record and restoration for quit and unexpected quit -- bugs fixing [WIP] Hyper Sessions record Nov 26, 2016
@ppot ppot changed the title [WIP] Hyper Sessions record Hyper Sessions record Nov 26, 2016
@ppot ppot changed the title Hyper Sessions record Hyper sessions record Nov 26, 2016
@ppot ppot changed the title Hyper sessions record Hyper Sessions restoration Nov 26, 2016
@ppot
Copy link
Contributor Author

ppot commented Nov 28, 2016

Commit e1ee608 close #1046

@ppot
Copy link
Contributor Author

ppot commented Nov 28, 2016

@matheuss @rauchg Review Needed

@ppot ppot force-pushed the hyper_record branch 3 times, most recently from 868e69d to d6f9f92 Compare December 7, 2016 22:01
@ppot
Copy link
Contributor Author

ppot commented Feb 2, 2019

@VinceBT I started a thread for this feature, but nobody answered yet!

@ppot
Copy link
Contributor Author

ppot commented Feb 2, 2019

@rauchg Any take on how you would see session restoration?

@ppot
Copy link
Contributor Author

ppot commented Feb 13, 2019

@chabou, @rauchg While trying to make a session restoration plugin. I came across this problem. Since I can't share a state between

exports.onApp = () => {
}

exports.onWindow = (window) => {
}

and

exports.middleware = (store) => (next) => (action) => {
}

I can't have a global state residing inside my plugin. The reason is since we decouple the backend and the front-end.

While I can listed to onWindow event for new window, I can store them great. Same for the middleware I can invoke specific action and create new recorded session with their desired state. But still. If I make a recorder on top of it. each window will have a undefined instance of the window it's create and if I make the recorder inside let say:

  if ('INIT' === action.type) {
      const window = new Window('INIT');
      record.onWindow(window);
      console.log(reccord);
  }

Each window will have one instance of the recorder. So how would we share this state between the two.

The ideal way would be to listed to the RPC localy inside the plugin on the hyper process level. The other way around would be to totally integrate the session recorder inside hyper-core like at the present level of this PR.

In order to have this possibility we could separate the RPC in two.

  • One rendererRPC = which is the rendered Window.
    • decorating the Term
  • One terminalRPC = which is the terminal process.
    • new window
    • new session
    • And so on..

One hacky way, which is code-smelling would be to have a stored state in a local file and make read/write action for every updated state which is not the goal here. No need to make multiple IO and slowing the term.

I am open for comment and suggestions.

@chucklu
Copy link

chucklu commented Apr 9, 2019

Have the same feature request

@autonome
Copy link

autonome commented May 1, 2019

One hacky way, which is code-smelling would be to have a stored state in a local file and make read/write action for every updated state which is not the goal here. No need to make multiple IO and slowing the term.

Reading this issue gave me flashbacks: I implemented session save/restore in Firefox 2 in 2006. It basically worked the way you describe here.

12 years later, Mozilla is almost finished making that code not slow (😂+😭), but protecting user data is a trade-off I'd make 100x over again.

Off-by-default-until-fast is a nice balance between performance and protection, if that's easier to swallow than some interim perf hit. But no protection option leaves us developers living in fear 😅

@wclr
Copy link

wclr commented May 2, 2019

If not to restore sessions, is it currently possible to create some predefined (config layout) on the app start, so it would open needed tabs and split pane and need?

@caina-jumia
Copy link

If not to restore sessions, is it currently possible to create some predefined (config layout) on the app start, so it would open needed tabs and split pane and need?

I use hypercwd and set initialWorkingDirectory to my desire

@wclr
Copy link

wclr commented May 3, 2019

@caina-jumia I too use it, but I need tabs and split panes setup.

@Stanzilla
Copy link
Contributor

@ppot worth keeping this open or will you make a new one when you work on this again anyway?

@ppot
Copy link
Contributor Author

ppot commented Oct 15, 2019

@Stanzilla worth keep it open. I'm exploring the rust binding for speed

@Stanzilla Stanzilla closed this Oct 15, 2019
@Stanzilla Stanzilla reopened this Oct 15, 2019
@Stanzilla
Copy link
Contributor

Oops miss clicked, alright then!

@JWess
Copy link

JWess commented Jun 17, 2020

Is this dead?

@zradeg
Copy link

zradeg commented Jul 22, 2020

Hey, @ppot! Have you any progress in this task?
It's really rescue thing, anyway.

Appositely, thank you a lot for you work!

@MentalGear
Copy link

This seems almost done, right ?

@LabhanshAgrawal
Copy link
Collaborator

LabhanshAgrawal commented Apr 13, 2021

This seems almost done, right ?

No
It'll need to be updated as the codebase has been ported to typescript, and has changed quite a bit.

@Amesys
Copy link

Amesys commented Jun 15, 2021

Hi reviewers, any status on this feature ?
Would be quite handy to have.

@skm7463
Copy link

skm7463 commented Jun 16, 2021

Hi Guys, I just want to understand the request as I'm working on something myself.

Is the request to save & restore tabs, panes, windows, positions and cwd for each?

Have I missed anything?

@LabhanshAgrawal
Copy link
Collaborator

Hi reviewers, any status on this feature ?
Would be quite handy to have.

no updates right now, though it might be doable now as we've started releasing again and so the development should pick up a bit.

Hi Guys, I just want to understand the request as I'm working on something myself.

Is the request to save & restore tabs, panes, windows, positions and cwd for each?

Have I missed anything?

that's all I guess, you can also include restoring terminal content using xterm serialization addon if you want.

@skm7463
Copy link

skm7463 commented Jun 16, 2021

Hi reviewers, any status on this feature ?
Would be quite handy to have.

no updates right now, though it might be doable now as we've started releasing again and so the development should pick up a bit.

Hi Guys, I just want to understand the request as I'm working on something myself.
Is the request to save & restore tabs, panes, windows, positions and cwd for each?
Have I missed anything?

that's all I guess, you can also include restoring terminal content using xterm serialization addon if you want.

... From what I can see so far the serialization addon saves out the terminal buffer, not yet sure how that would be useful for restoring it because ultimately I assume the goal would be to restore the shell session which is a different issue especially the command state and process state in the shell.

I've already handled capture and save options of terminal content anyway and gone a little further than the serialisation addon.

Any ideas on approaching restoring the shell process state are very welcome

@lfaveur
Copy link

lfaveur commented Sep 10, 2022

Hi this feature is it still relevant? or is it abandoned?

@iljaiwjew
Copy link

Is it done or WIP or else?

@tendallas
Copy link

What is the current status? It's almost 4 years ( What does blocks this feature?

@ghost
Copy link

ghost commented Apr 30, 2024

Circling back to this, has this been reviewed or help is needed? The session restoration feature is something that is quite handy

@jacobhillock
Copy link

I am looking to migrate over to here, this feature is a must have. Thank you!

@sagarpanchal
Copy link

I am looking to migrate over to here, this feature is a must have. Thank you!

I have been waiting since 2020

@michaelsieminski
Copy link

this would be cool, but i guess it's not happening since its here since 2016 xD

@brun0xff
Copy link

brun0xff commented May 3, 2025

I have been waiting for this since 2017

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

Successfully merging this pull request may close these issues.