libtmux Reference MCP Search
On this page

libtmux.Session

View as Markdown

Module
libtmux
Package
libtmux
Source
src/libtmux/session.py
class libtmux.Session
class [source]
class [source]
class libtmux.Session

tmux(1) Session [session_manual].

Holds Window objects.

Examples

>>> session
Session($1 ...)
>>> session.windows
[Window(@1 ...:..., Session($1 ...)]
>>> session.active_window
Window(@1 ...:..., Session($1 ...))
>>> session.active_pane
Pane(%1 Window(@1 ...:..., Session($1 ...)))

The session can be used as a context manager to ensure proper cleanup:

>>> with server.new_session() as session:
...     window = session.new_window()
...     # Do work with the window
...     # Session will be killed automatically when exiting the context

References

[session_manual]

tmux session. openbsd manpage for TMUX(1). "When tmux is started it creates a new session with a single window and displays it on screen..." "A session is a single collection of pseudo terminals under the management of tmux. Each session has one or more windows linked to it." https://man.openbsd.org/tmux.1#DESCRIPTION. Accessed April 1st, 2018.

44 declared, 204 inherited

Members

Inherited members

Reached through libtmux.common.EnvironmentMixin, libtmux.neo.Obj, libtmux.hooks.HooksMixin, libtmux.options.OptionsMixin.

Esc

Type to search.