feat: restore only the sessions in the tmux layout #41
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/tmux-layout-sessions-only"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What changes
Save Layoutnow stores the session names only; the window geometry and thepane directories are gone from the snapshot (
tmux-layoutfile version 2).Load Layoutrecreates only the missing sessions, each with exactly one windowin the home directory, and leaves the existing sessions alone. The lone
0/NN:0session after a reboot is still adopted by the first saved session,and its fresh shell is respawned in the home directory.
loadaccepts a version 1 file too and ignores itsWandPlines, so thesnapshot written before this change still restores its sessions.
Why
The pane state was never restored anyway — tmux cannot serialise a process, so
a load only ever re-ran a shell in the saved directory. Keeping the geometry
made the snapshot depend on the terminal size it was taken at, and the
resize-windowcall that pinned the windows to a manual size was the cause ofthe tiny restored windows (see the previous fix). A session list is the part
that actually helps: it rebuilds the workspace shape without pretending to
restore what ran inside it.
Verification
On a scratch tmux server (
tmux -L tmltest), all paths:CandSlines, version 2;01:a:1 cwd=/root,02:b:1 cwd=/root, one windoweach,
window-size=latest;window each;
01:0→ adopted and respawned in/root.