Hyper: Session serialization/storage/restoration

Created on 5 Aug 2016  路  4Comments  路  Source: vercel/hyper

It'd be really nice if when hypertyerm quit, the current sessions were stored somehow, somewhere, so that when hyperterm restarted, they would be restored. This is most helpful during computer restarts or accidental quits. This is also another handy feature that iTerm has.

help wanted High Feature Request

Most helpful comment

@matheuss This is my PR #945

All 4 comments

@matheuss This is my PR #945

@ppot Thank you a lot for that contribution!

My 2 cents: Terminal.app on macOS, among other things like restoring CWD, passes the TERM_SESSION_ID environment variable into every shell process. If user then quits app with active session, on the next launch all shells will be re-initialized with the same TERM_SESSION_ID.

That allows a user to actually customize the restoration process by doing the following:

  1. User can define the shell_session_save_user_state function
  2. Terminal.app calls that function on exit (registered as trap ... EXIT)
  3. In the implementation user dumps whatever shell commands he wishes to execute to SHELL_SESSION_FILE (which is _~/.bash_sessions/$TERM_SESSION_ID.session_ for bash)
  4. On the next launch that file is sourced and then deleted

You can find the implementation of this logic in _/etc/bashrc_Apple_Terminal_.

It opens a lot of possibilities for customization by requiring very little from Hyper: just some kind of unique ID which it should be present anyway.

An example of such customization is preserving active virtualenv.

@Kentzo I like that idea.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarneeh picture sarneeh  路  3Comments

cilice picture cilice  路  3Comments

stan-stripe picture stan-stripe  路  3Comments

laur1s picture laur1s  路  3Comments

daenuprobst picture daenuprobst  路  3Comments