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.workspace.options.resolve_session_shell

tmuxp.workspace.options.resolve_session_shell ( session: t.Any, env: t.Mapping[str, str] | None = None ) → str

Resolve the effective interactive shell for a tmux session.

Description#

Prefers tmux's default-shell option (which reflects a workspace's options.default-shell once applied, otherwise tmux's global default), and falls back to the SHELL environment variable.

Examples#

>>> class FakeSession:
... def __init__(self, shell):
... self._shell = shell
... def show_option(self, name, **kwargs):
... return self._shell

The tmux default-shell wins when set:

>>> resolve_session_shell(FakeSession("/usr/bin/zsh"), env={})
'/usr/bin/zsh'

The SHELL env var is the fallback:

>>> resolve_session_shell(FakeSession(None), env={"SHELL": "/bin/bash"})
'/bin/bash'
Parameters
Returns

str resolved shell path/name, or "" when undeterminable

Esc

Type to search.

Reference preview Open reference