Session Persistence
This feature is not yet implemented.
When your computer reboots (or gmuxd restarts), all sessions are lost. Session persistence would let you pick up exactly where you left off.
The idea
Section titled “The idea”After a reboot, opening gmux shows your previous sessions in a “suspended” state. A Resume All button on each folder restarts every session in that folder. Sessions that have their own state management (like pi) resume seamlessly. Plain shell sessions restart with the previous scrollback visible above a separator line.
How it would work
Section titled “How it would work”On shutdown (best-effort)
Section titled “On shutdown (best-effort)”When gmux exits (clean shutdown or SIGTERM), it writes the tail of its scrollback ring buffer to a file alongside the session metadata. This is best-effort — a hard power-off may lose it.
On resume
Section titled “On resume”- gmuxd discovers persisted session files on startup (it already does this for
pisessions). - The user clicks Resume on a session or Resume All on a folder.
- gmuxd launches a new gmux with the same command and cwd.
- The new gmux seeds its scrollback with the saved content, followed by a separator:
─── session resumed ───- The child process starts writing after the separator. Tools like
pithat clear the screen will overwrite the preamble naturally. Plain commands (shell, scripts) will have their old output visible above.
What’s needed
Section titled “What’s needed”- gmux: Write raw scrollback to
~/.local/state/gmux/scrollback/<session-id>.rawon exit. - gmuxd: Discover persisted scrollback files. Include them in session metadata so the UI knows scrollback is available.
- gmux: Accept a
--seed-scrollback <path>flag that pre-fills the ring buffer before the child starts. - UI: “Resume All” button on folder headers. Visual treatment for suspended sessions.
Prerequisite
Section titled “Prerequisite”This builds on the work to keep gmux alive after child exit — once sessions survive process exit within a single boot, surviving across boots is the natural next step.