# control.ControlSender.watch_only

- **Module:** control.ControlSender
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/control.rs#L1074
- **Page:** https://libtmux.org/en/rs/latest/reference/control-controlsender-watch_only/

```
control.ControlSender.watch_only(self, panes: &[PaneId]) -> Result<(), Error>
```

Receive output from these panes and no others.

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.
