Restore last work session (layout, tabs, history, current directory, ...)

Bug #1257259 reported by legaliz_me
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Terminator
New
Wishlist
Unassigned

Bug Description

It would be nice to have an option to restore the previous work session on startup.

The "Restore last session" could work similarly to Chromium "Pick up where you left off" :

- Save layout information (position, size of terminals)
- Save tabs layout
- Restore the current folder when closed
- Show the previous history grayed out

I'm mainly interested in the status of those features and the possibility to implement them with current Terminator.

For saving layout information, It's already possible but it doesn't include tabs right?

What about the other points?

Changed in terminator:
importance: Undecided → Wishlist
legaliz_me (r3m1-benoit)
description: updated
Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

OK, so right now the
  - Save layout information (position, size of terminals)
  - Save tabs layout
  - Restore the current folder when closed
are all saved when saving layouts. (Some of these bits might only be in trunk.

Theoretically it should be possible to add a check box in the layout pane to save session on exit. This would need thought, because if you have multiple windows in your layout/session, right now there is no way to exit the whole layout/session. You can just close one window at a time. Possibly a keyboard shortcut for those that want it? I don't think I'd want it enabled or in the menu by default, because it's somewhat of a nuclear option.

The bit
  - Show the previous history grayed out
would be somewhere between tricky and impossible. I guess it would be in three parts:
1) On exit save the scrollback buffer to somewhere like ~/.cache/terminator/${TERM_UUID}_buffer.out (How to prevent it forever growing?)
2) On load push the saved cache file into the vte widget. (Can it be done direct? Or use "cat"? How to grey out? Or draw a horizontal line?)
3) Start the command as usual.

Revision history for this message
Jeffery Wilkins (djcanadianjeff) wrote :

my computer crashes alot and sometimes we loose power at our house

this would be awesome!!!!! to pick up where you "left off"

Revision history for this message
Adrian Simmons (adrinux) wrote :

On OSX iTerm2 (at least beta3) will restore both layout and session, I believe it relies on screen or tmux for restoring sessions but does so transparently to the user. Given iTerm is open source it might help to look at how it restores sessions https://github.com/gnachman/iTerm2

For now the workaround probably involves tmux and tmux-resurrect, if I can figure all that out :)

Revision history for this message
Nathan (elitebadger) wrote :

@Stephen Boddy

1) Terminator has a setting for number of scrollback lines. Seems reasonable to restrict that file to the same number of lines to solve the unbounded growth problem.

I was wondering if there would be problems with multiple windows. What if I just leave Terminator open when I shut down? Even though I have three windows open right now I note that there is one terminator process running, so you wouldn't have to worry about IPC coordination. If for some reason I want to close all Terminator windows at once without shutting down the computer I can just send it SIGTERM or something, I guess (see below).

@Jeffery Wilkins

Note that Stephen's proposal above will not address your use case because it only covers clean exit. Perhaps an additional setting to continuously sync scrollback history to disk in case of unexpected termination. I believe this should be a setting because the user's homedir might be on e.g. NFS storage and if the network is lossy you don't want terminator to slow to a crawl as a result. But for the usual case where the user's homedir is on local storage I don't think it should be too problematic.

Revision history for this message
Stephen Boddy (stephen-j-boddy) wrote :

Just for anyone else tracking this, Nathan joined from https://answers.launchpad.net/terminator/+question/532791

Where there was some interesting thoughts exchanged on how we could persist things like per terminal history (commands run, not the output) too.

@Nathan: 1) We still need to handle someone setting infinite scrollback. Perhaps we can grow indefinitely, (although saving it would slow the exit down as this was retrieved from the /tmp/<deleted_files> that vte uses for scrollback, then saved to a file) and only truncate when the user uses the terminal reset which clears the buffer. Of course there was a hoo-ha when it was discovered that the vte widget was saving the session log into /tmp without encryption (it now encrypts) so should we also have to encrypt this info? Sensitive detail stored? How do we persist across separate sessions? If we have a defined key, then someone can find that and read your files anyway. (I think the vte encryption key is thrown away when exiting.)

2?) We don't have a nuclear quit option at the moment. It would be a relatively easy shortcut to add. We do have just one process in daemon mode, but a number of things can start additional processes (the simplest being Super+I) Not sure if the shutdown process sends SIGTERM to processes so they can do a sane shutdown.

Your response to Jeffery is 100% right.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.