OSX will save/restore application state across restarts, i.e. restore all windows with the same state as before.
I want that with a deep call hierarchy, even across systems, across Terminal.app, fish, mosh, ssh, tmux, etc. More specifically, my common call stack:
OSX -> Terminal.app -> fish -> mosh i6-direct -> ssh sulfid -> tmux a || tmux
- OSX Terminal.app restore is already handled by OSX.
- fish save/restore (inside OSX Terminal.app) can be done via fish event handlers
- mosh: mosh-client has host, server IP and UDP port in it; mosh-server, can see open UDP socket (/proc/pid/fd), check port (/proc/pid/net/udp)
CRIU: Checkpoint/Restore In Userspace, for Linux.
DMTCP: Distributed MultiThreaded CheckPointing.
Core app design: User Interface Preservation,
restoreWindow
and co
Restore specific Terminal history from .bash_sessions?,
TERM_SESSION_ID
env var
BASH_SESSION
env var?
fish_history
env var?
trap ... EXIT
-> only single trap per session, so do not use this, use event handlers instead, fish_exit
event.
Could setup fish_preexec
and fish_postexec
event handlers to store current active command,
per session ID (TERM_SESSION_ID
).
(Autoloading functions does not work for event handler functions.)
Fish config for startup script (startup event) + setting up other events.
tmux-resurrect, tmux resurrect fish issue 217, Fish issue 4705, tmux-continuum
Reattach existing session: not really possible, except maybe generic solutions like CRIU