Then build a session freezer that snapshots a running tmux session and rebuilds it later. libtmux drives a real tmux server from code. It gives you objects for the server, its sessions, windows and panes. Documentation for every language is at https://libtmux.org/en/. Language: C++ Package: libtmux-cxx (its repository) Repository: https://github.com/libtmux/libtmux-cxx Read these before writing code: - https://libtmux.org/en/cxx/latest/llms.txt every page for C++, as a list - https://libtmux.org/en/cxx/latest/docs.json the same list with headings, as JSON - https://libtmux.org/en/cxx/latest/reference/ the C++ API reference If you cannot fetch URLs, clone the repository above and read its README and examples instead, or ask me to paste those pages in. Set up first: 1. Report the tmux version with `tmux -V`. libtmux drives a real tmux, so nothing below works without one. Stop and tell me if it is missing. 2. If this directory is not a C++ project yet, write a CMakeLists.txt declaring cmake_minimum_required and project(), targeting C++23. Skip this in a project that already exists, and match what is here. 3. Add the dependency. libtmux-cxx is not published to its registry yet, so this installs from the repository at tag v0.1.0-alpha.11. include(FetchContent) FetchContent_Declare(libtmux-cxx GIT_REPOSITORY https://github.com/libtmux/libtmux-cxx GIT_TAG v0.1.0-alpha.11) FetchContent_MakeAvailable(libtmux-cxx) Check https://github.com/libtmux/libtmux-cxx for a newer version, and prefer a stable release over this one if there now is any. 4. Write the smallest program that proves the install works: connect to a tmux server, create a session, confirm it is there, then kill it. Give that server a socket of its own rather than using the default one, so this never touches a tmux I am already running. Run it, and show me the output and the files you added. Rules for everything below: - Use the reference above rather than guessing names. The ten libtmux ports do not share spellings, and a name from another language will look plausible and not exist. - If the reference does not have something you expected, say so instead of writing a call that does not exist. - Follow the conventions already in this repository. Session freezer What it does: - Reads a live session and writes a workspace file describing it: windows, their names and layouts, each pane's working directory and running command. - Rebuilds that session from the file, on this machine or another one. - Round-trips. Freezing a session, rebuilding it, and freezing it again gives the same file. Show me that this holds rather than asserting it. Constraints: - Record the working directory each pane is actually in, not the directory the session started in. - A running command and a shell sitting at a prompt are different states. Do not write a shell prompt out as if it were a command to re-run. - Say what you deliberately do not capture. Scrollback and program state do not survive this, and a reader should know that before trusting it. Anchor it in these pages: - https://libtmux.org/en/tmux/concepts/workspaces/ workspaces - https://libtmux.org/en/tmux/concepts/queries/ queries - https://libtmux.org/en/tmux/examples/workspace-from-file/ workspace from file