JonnyHaystack / i3-resurrect

Simple solution to saving and restoring i3 workspaces
GNU General Public License v3.0
379 stars 19 forks source link

Save/restore terminal history #107

Closed Rasie1 closed 2 years ago

Rasie1 commented 2 years ago

Currently, i3-resurrect restores working directory of terminals. Another important part of terminal state is history - this would allow user to quickly run previously started program by running latest command in terminal, and to remember what they were doing here

I'm not sure if it's even possible to get histories from inside terminals like that, but it could somehow grab the history (e.g. using history command) on save, and then history -r it on restore.

If retrieving history is really possible, then this approach could be used to generally restore more program state because some programs could be ran with arguments.

JonnyHaystack commented 2 years ago

This is really shell dependent and there's no way of knowing which command was ran in which terminal window, so this is outside the scope of i3-resurrect. Maybe you can solve it by doing some scripting of your own. If you want the program running in a terminal to be restored, then you will have to launch the terminal with that command in the first place. E.g. alacritty -e "tmux a". i3-resurrect can successfully save and restore that, and I do use that in order to have certain tmux sessions restored on specific workspaces.