tmuxp.cli.load.load_workspace
-
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
ConfigReaderto load a JSON/YAML into adict. Thenexpandandtricklewill be used to expand any shorthands, template variables, or file paths relative to where the config/script is executed from.expandaccepts 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.Serverobject 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.whichis ran. It will raise an exception if tmux isn't found.If a tmux session under the same name as
session_namein 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!).buildwill 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
TMUXenvironment 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
-
-
workspace_file(StrPath ) # – paths or session names to workspace files -
socket_name(str | None) # –tmux -L <socket-name> -
socket_path(str | None) # –tmux -S <socket-path> -
tmux_config_file(str | None) # -
new_session_name(str | None) # –tmux new -s <new_session_name> -
colors(int | None) # – Force tmux to support 256 or 88 colors. -
answer_yes(bool) # – Assume yes when given prompt to attach in new session. Default False. -
append(bool) # – Assume current when given prompt to append windows in same session. Default False. -
cli_colors(Colors | None) # – Colors instance for CLI output formatting. If None, usesAUTO. -
progress_format(str | None) # – Spinner format preset name or custom format string with tokens. -
panel_lines(int | None) # – Number of script-output lines shown in the spinner panel. Defaults to theSpinnerdefault (3). Override viaTMUXP_PROGRESS_LINESenvironment variable. -
no_progress(bool) # – Disable the progress spinner entirely. Default False. Also disabled whenTMUXP_PROGRESS=0.
-