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

tmuxp.workspace.options.resolve_session_shell

Python
  • Python
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java Unavailable
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

API reference · Markdown

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

Resolve the effective interactive shell for a tmux session.

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
  • session ( t.Any ) – live session exposing show_option("default-shell")

  • env ( t.Mapping[str, str] | None ) – environment mapping for the SHELL fallback; defaults to os.environ

Returns

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

Esc

Type to search.