Understand the libtmux object hierarchy
masterlibtmux follows the hierarchical structure of a tmux server. You can navigate through related objects in both directions (down to children or up to parents):
Server: The top-level object containing all sessions.Session: Groups one or more windows.Window: Groups one or more panes.Pane: The leaf node (the actual terminal area).
Traversal Examples:
- Downwards: Use properties like
session.windowsto list children. - Upwards: Use properties like
pane.sessionto jump from a pane back to its parent session.
Note: Accessing these properties queries tmux fresh every time. For performance in loops, bind the collection to a variable first.
>>> # Downward traversal
>>> session.windows
[Window(...), ...]
>>> # Upward traversal
>>> pane.session
Session($... ...)
>>> # Full upward path
>>> pane.window.session.server is server
True