Documentation

You arranged a session by hand, it is finally right, and you would like to not do that again tomorrow. save writes the session you are in to a .glaze profile. It captures the shape of the session and, on purpose, nothing that runs. The why is further down, and it is worth the read before you ask for the opposite.

Console
$ glaze save                        # write ./.glaze from the current session
$ glaze save --stdout               # print the profile; do not write
$ glaze save --session daemon-run --profile-path ./daemon-run.glaze
$ glaze save --force                # replace an existing ./.glaze

For the full workflow, from save to a profile you can commit, see Save a session.

Flags

FlagDescription
--sessionThe session to capture. The default is the session of the pane that runs save. Outside a pane of the target tmux server, the flag is necessary.
--profile-pathThe output path. The default is .glaze.
--stdoutPrint the profile. Do not write a file.
--forceReplace the file at --profile-path if it exists.
--socket-path / --socket-nameA custom tmux socket. See Custom sockets.

An existing file

save does not replace an existing file unless you set --force. A symlink that points to a missing file also counts as an existing file. The check runs before the capture, so a refused save touches nothing. With --force, it writes the same way as format: through a temporary file, through a symlink and with the permissions of the old file.

What save captures

note

save captures the structure of a session: the session, window and pane names, the starting directories, the focus and the layout. tmux reports a window layout only as a low-level coordinate string, for example bb62,80x24,0,0. It does not report a named preset. The save command writes that raw string verbatim as a fallback. The up command replays it exactly. Thus Glazier restores your pane geometry even when it does not match a named preset. By design save does not export pane commands, environment variables, hooks or tmux options.

This is a deliberate safety choice, not a missing feature:

  • An exported command runs again on the next glaze up. A hook is a command bound to an event, thus the same risk applies. A destructive command from a forgotten pane can delete your filesystem or overload a database on replay.
  • Glazier can read environment variables only as the full session environment. That environment includes secrets from your shell, for example tokens and keys. An export writes those secrets into a file that you could commit.
  • Options read back as effective state. They mix your tmux.conf and your manual changes with the values that glaze set. To apply that state again on up gives unwanted results.

Treat a saved profile as a scaffold. It recreates your layout. You add the commands, the environment variables and the options by hand.

The common thread is provenance. tmux can tell Glazier the effective state of a session, but not which part of that state Glazier set and which part came from your tmux.conf, your shell or a set-option you typed last Tuesday. Everything save leaves out is either a command that would run again or a value whose origin tmux cannot name. I would rather you type commands = [...] into a scaffold than discover what a forgotten pane does on replay.

Layout capture

tmux reports a layout as a coordinate string with a checksum, for example bb62,80x24,0,0. save writes the string into the layout attribute of the window. up passes it to tmux select-layout unchanged. The profile check accepts a named preset or a well formed coordinate string. tmux checks the checksum itself at up, so a hand edited geometry with an old checksum fails there.

A raw layout fully specifies the pane geometry. In a window with a raw layout, up skips each size and adjust block and shows a warning that names the pane. See Window.

tmux 3.9 and later print a layout as JSON, for example {"V":2,"L":{"t":"h","w":80,"h":24,...}}, and save writes the form that your tmux prints. Glazier accepts both forms. A JSON layout has no checksum, but it needs tmux 3.9 or later; tmux 3.9 also accepts the classic string. To share a saved profile with users of an older tmux, replace a JSON layout with a named preset.

A saved raw layout string is exact but not easy to read. You can replace it with a named preset, for example tiled or main-vertical, in a profile that you edit by hand.

What save leaves out because tmux chose it

save leaves out what tmux set by default and what no longer exists, so the profile stays valid and portable.

Captured valueRule
A pane name equal to the host nameLeft out. The host name is the default pane title of tmux.
A window name under automatic-renameLeft out. tmux names the window after its program, so the name changes on each run.
A directory that no longer existsLeft out with a warning. The pane then uses the directory of its session.
An empty session nameWritten as no name. up then uses default.

A window that Glazier or you named has automatic-rename off, because new-window -n and rename-window turn it off. Thus save keeps every name that someone chose and drops every name that tmux chose.