Comment 6 for bug 1550898

Revision history for this message
In , Boris-astardzhiev (boris-astardzhiev) wrote :

Created attachment 9553
Restore scrollback history on save session

I've always wanted xfce4-terminals to preserve scrollback history across reboots/logouts.
Sometimes I omit powering off my machine only due to the fact that I will lose history across terminals as I have many of them. Unfortunately this is not green at all. Moreover if I do shutdown my machine the next day it's pretty hard to restart my work the way it was prior to shutdown. Yes, there are instruments like tmux/screen (and yes I use them myself) but they may be a burden for ordinary users.

Please consider the following patch. It basically does:
1) Scrollback history is saved across logouts/reboots if enabled via xfce4-terminal's preferences and if 'Save session for future logins' is checked.
2) Environment variable TAB_ID is exported in every terminal screen. It's a 16 character version of a SHA256 checksum. A seed identical to role-id is used for the generation of the checksum.
3) Scrollbacks are private to the user itself. They're stored in ~/.cache/xfce4/terminal/. They're GZIP compressed as well. Saving is done immediately on logging out which is tied to the 'save-session' event.
4) On logging in and after restoration scrollback files are deleted.
5) Since such histories may expose sensitive data everything is configurable and can be disabled thus no scrollback files will be saved at all.
6) It's up to the user to decide what fits him/her best and if this violates security or other implications user can omit using it.

As a future work, I think shell history may be tied per terminal. When time permits I can go and investigate this idea further. I think this will be a nice add-on to this feature.

Please share your opinions and provide some code review if you're positively inclined to incorporating this feature.

Regards,
Boris