Workspace ManagerstableAPI Reference

Choose documentation 3

stable

Current version

stable
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

tmuxp.cli.load.load_workspace

tmuxp.cli.load.load_workspace
( 13 parameters ) ( workspace_file: StrPath, socket_name: str | None = None, socket_path: str | None = None, tmux_config_file: str | None = None, new_session_name: str | None = None, colors: int | None = None, detached: bool = False, answer_yes: bool = False, append: bool = False, cli_colors: Colors | None = None, progress_format: str | None = None, panel_lines: int | None = None, no_progress: bool = False, )
→ Session | None

Entrypoint for tmuxp load, load a tmuxp "workspace" session via config file.

Description#

Notes

tmuxp will check and load a workspace file. The file will use ConfigReader to load a JSON/YAML into a dict . Then expand and trickle will be used to expand any shorthands, template variables, or file paths relative to where the config/script is executed from.

expand accepts the directory of the config file, so the user's workspace can resolve absolute paths relative to where the workspace file is. In otherwords, if a workspace file at /var/moo/hi.yaml has ./ in its workspaces, we want to be sure any file path with ./ is relative to /var/moo, not the user's PWD.

A libtmux.Server object is created. No tmux server is started yet, just the object.

The prepared workspace and its server object is passed into an instance of WorkspaceBuilderProtocol.

A sanity check against libtmux.common.which is ran. It will raise an exception if tmux isn't found.

If a tmux session under the same name as session_name in the tmuxp workspace exists, tmuxp offers to attach the session. Currently, tmuxp does not allow appending a workspace / incremental building on top of a current session (pull requests are welcome!).

build will build the session in the background via using tmux's detached state (-d).

After the session (workspace) is built, unless the user decided to load the session in the background via tmuxp -d (which is in the spirit of tmux's -d), we need to prompt the user to attach the session.

If the user is already inside a tmux client, which we detect via the TMUX environment variable bring present, we will prompt the user to switch their current client to it.

If they're outside of tmux client - in a plain-old PTY - we will automatically attach.

If an exception is raised during the building of the workspace, tmuxp will prompt to cleanup ($ tmux kill-session) the session on the user's behalf. An exception raised during this process means it's not easy to predict how broken the session is.

Parameters
Esc

Type to search.

Reference preview Open reference