Loader - tmuxp.workspace.loader#

Workspace hydration and loading for tmuxp.

tmuxp.workspace.loader.expandshell(value)[source]#

Resolve shell variables based on user’s $HOME and env.

os.path.expanduser() and os.path.expandvars().

Return type:

str

Parameters:

value (str) – value to expand

Returns:

value with shell variables expanded

Return type:

str

tmuxp.workspace.loader.expand_cmd(p)[source]#

Resolve shell variables and expand shorthands in a tmuxp config mapping.

Return type:

Dict[str, Any]

tmuxp.workspace.loader.expand(workspace_dict, cwd=None, parent=None)[source]#

Resolve workspace variables and expand shorthand style / inline properties.

This is necessary to keep the code in the WorkspaceBuilder clean and also allow for neat, short-hand “sugarified” syntax.

As a simple example, internally, tmuxp expects that workspace options like shell_command are a list (array):

'shell_command': ['htop']

tmuxp workspace allow for it to be simply a string:

'shell_command': 'htop'

ConfigReader will load JSON/YAML files into python dicts for you.

Return type:

Dict[str, Any]

Parameters:
  • workspace_dict (dict) – the tmuxp workspace for the session

  • cwd (str) – directory to expand relative paths against. should be the dir of the workspace directory.

  • parent (str) – (used on recursive entries) start_directory of parent window or session object.

Return type:

dict

tmuxp.workspace.loader.trickle(workspace_dict)[source]#

Return a dict with “trickled down” / inherited workspace values.

This will only work if workspace has been expanded to full form with loader.expand().

tmuxp allows certain commands to be default at the session, window level. shell_command_before trickles down and prepends the shell_command for the pane.

Return type:

Dict[str, Any]

Parameters:

workspace_dict (dict) – the tmuxp workspace.

Return type:

dict