libtmux Reference MCP Search
On this page

pane.observe.Pane.capture

View as Markdown

Module
pane.observe
Declared in
Pane
Package
libtmux
Source
crates/libtmux/src/pane/observe.rs
Other languages
PythonTypeScriptGoJava.NETC++Swift
capture ( self ) Result<Vec<TmuxText>, Error>
method [source]
method [source]
capture

Capture the pane's visible contents, one entry per line.

Lines are [ TmuxText ] because a terminal's contents are arbitrary bytes, not guaranteed UTF-8.

Errors

Returns an error when tmux refuses the command.

In other languages Read a pane’s visible contents

Examples

>>> pane = window.split(shell='sh')
>>> pane.capture_pane()
['$']
>>> pane.send_keys('echo "Hello world"', enter=True)
>>> pane.capture_pane()
['$ echo "Hello world"', 'Hello world', '$']
>>> print(chr(10).join(pane.capture_pane()))
$ echo "Hello world"
Hello world
$
const lines = await pane.capture();
lines.at(-1);

0 declared, 0 inherited

Esc

Type to search.