Options - tmuxp.workspace.options¶
Behavior options for tmuxp workspace builders.
The workspace_builder_options config catalog holds settings that tune how a
workspace builder runs, independent of which builder is selected. It is a
sibling to the tmux options / global_options / environment catalogs
and is the home for builder-behavior knobs (today: pane readiness; later:
parallel/async builder settings).
Example
workspace_builder_options:
pane_readiness: auto # auto | always | never (+ truthy/falsy aliases)
-
class tmuxp.workspace.options.PaneReadiness¶class tmuxp.workspace.options.PaneReadiness¶
Bases:
EnumPolicy for whether the builder waits for a pane’s shell prompt.
tmuxp waits for each default-shell pane to draw its prompt before dispatching layout and commands, which avoids a zsh prompt-redraw artifact (see
tmuxp.workspace.builder.classic._wait_for_pane_ready()). The wait is only needed for zsh, so the defaultAUTOpolicy waits only when the session’s interactive shell is zsh.
-
class tmuxp.workspace.options.WorkspaceBuilderOptions¶class tmuxp.workspace.options.WorkspaceBuilderOptions¶
Bases:
objectParsed
workspace_builder_optionscatalog.An absent
workspace_builder_optionscatalog uses the defaults, whosePaneReadiness.AUTOpolicy waits for a pane’s prompt only when the session shell is zsh: zsh workspaces build as before, while bash, sh, and other shells skip the wait. Setpane_readiness: alwaysto restore the previous wait-everywhere behavior.
-
tmuxp.workspace.options.shell_is_zsh(shell)¶tmuxp.workspace.options.shell_is_zsh(shell)¶
Return
Truewhenshellnames the zsh shell.- Parameters:
shell (
str or None) – a shell path or name (e.g./usr/bin/zsh)- Return type:
Examples
>>> shell_is_zsh("/usr/bin/zsh") True >>> shell_is_zsh("/bin/bash") False >>> shell_is_zsh(None) False
-
tmuxp.workspace.options.resolve_session_shell(session, env=None)¶tmuxp.workspace.options.resolve_session_shell(session, env=None)¶
Resolve the effective interactive shell for a tmux session.
Prefers tmux’s
default-shelloption (which reflects a workspace’soptions.default-shellonce applied, otherwise tmux’s global default), and falls back to theSHELLenvironment variable.- Parameters:
session (
libtmux.Session) – live session exposingshow_option("default-shell")env (
Mapping,optional) – environment mapping for theSHELLfallback; defaults toos.environ
- Returns:
resolved shell path/name, or
""when undeterminable- Return type:
Examples
>>> class FakeSession: ... def __init__(self, shell): ... self._shell = shell ... def show_option(self, name, **kwargs): ... return self._shell
The tmux
default-shellwins when set:>>> resolve_session_shell(FakeSession("/usr/bin/zsh"), env={}) '/usr/bin/zsh'
The
SHELLenv var is the fallback:>>> resolve_session_shell(FakeSession(None), env={"SHELL": "/bin/bash"}) '/bin/bash'