Skip to content

Latest commit

 

History

History
65 lines (38 loc) · 2.59 KB

restore-app-session.md

File metadata and controls

65 lines (38 loc) · 2.59 KB

Overall

OSX

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)

Technical

Generic

CRIU: Checkpoint/Restore In Userspace, for Linux.

DMTCP: Distributed MultiThreaded CheckPointing.

OSX AppKit level

Core app design: User Interface Preservation, restoreWindow and co

OSX Terminal.app

Restore specific Terminal history from .bash_sessions?, TERM_SESSION_ID env var

Bash

BASH_SESSION env var?

Fish

fish_history env var?

fish_apple_terminal.fish.

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

tmux-resurrect, tmux resurrect fish issue 217, Fish issue 4705, tmux-continuum

Mosh

Reattach existing session: not really possible, except maybe generic solutions like CRIU