Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux-rs latest

ControlSender.watch_only

Receive output from these panes and no others.

Source and package
Qualified name
libtmux::control::ControlSender::watch_only
Module
control
Declared in
ControlSender
Package
libtmux
Source
crates/libtmux/src/control.rs
pub async fn watch_only(&self, panes: &[PaneId]) -> Result< (), Error >

Description#

Lists panes in the session this connection attached to -- over this same connection, so the answer cannot disagree with it -- then mutes every one not named. See Self::mute_pane() for why this beats filtering what arrives, and why the listing must not reach past this connection's own session: off stops tmux reading a muted pane's pty for every client, not just this connection, so muting a pane outside this session would widen the change to whatever else is watching it, and a control client is sent only its attached session's output in the first place, so panes outside it were never part of this stream.

A pane created after this call is not muted, because tmux publishes no notification for a pane appearing. Repeat this whenever Event::may_have_added_a_pane() answers true.

Errors

Returns an error when the connection has closed, tmux would not list a pane, returned an unreadable pane ID, or a later mute fails. A failure after an accepted mute is Error::AfterEffect.

Cancel safety

The effect can be partial: panes are muted one at a time, so a dropped call can leave some muted and others not. Muting is idempotent, so calling again finishes the job.

Parameters

tmux command#

The tmux commands behind watch_only.

tmux C API#

The C declarations in tmux that implement these commands.

Guides#

Pages that discuss watch_only.

Esc

Type to search.

Reference previewOpen reference