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

Python API

Python documentation

View as Markdown

Module
libtmux
Package
libtmux
Source
src/libtmux/pane.py
Other languages
RubyLuaTypeScriptRustGoJava.NETC++Swift
class libtmux.Pane
class [source]
class [source]
class libtmux.Pane

tmux(1) Pane [pane_manual].

Pane instances can send commands directly to a pane, or traverse between linked tmux objects.

References

[pane_manual]

tmux pane. openbsd manpage for TMUX(1). "Each window displayed by tmux may be split into one or more panes; each pane takes up a certain area of the display and is a separate terminal." https://man.openbsd.org/tmux.1#WINDOWS_AND_PANES. Accessed April 1st, 2018.

Discussed in Build a workspace from a file · Python workspace internal API · Context managers

In other ports A tmux pane

Examples

>>> pane
Pane(%1 Window(@1 1:..., Session($1 ...)))
>>> pane in window.panes
True
>>> pane.window
Window(@1 1:..., Session($1 ...))
>>> pane.session
Session($1 ...)

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

>>> with window.split() as pane:
... pane.send_keys('echo "Hello"')
... # Do work with the pane
... # Pane will be killed automatically when exiting the context
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("work").await?;
let window = session.active_window().await?.expect("a session has a window");
let pane = window.active_pane().await?.expect("a window has a pane");
pane.send_line("echo hello").await?;
// Capture returns `TmuxText`, because a pane can print any bytes.
let lines = pane.capture().await?;
assert!(!lines.is_empty());
guard.shutdown().await?;

59 declared, 198 inherited

Members

Inherited members

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

Esc

Type to search.