# tmux.PaneObservation

- **Module:** tmux
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-go/blob/52968a3181c1c9e6d1b26c565d4b170968ae61c0/tmux/control_observation.go#L30
- **Page:** https://libtmux.org/en/go/latest/reference/tmux-paneobservation/

PaneObservation is one visible pane baseline followed by the exact control notification stream after that baseline. That stream is the observation's whole control connection, so a caller wanting only this pane's output selects it by identifier. Create one with [Pane.OpenObservation] and close it when finished. Copies share notification reader ownership, terminal loss, and client lifetime; closing one closes them all.

## Members

- `PaneID` (method): PaneID returns the pane selected at the observation boundary.
- `SessionID` (method): SessionID returns the session the observation's own control client attached to, resolved live when the observation opened - the session a listing must count this client's attachment against, not merely the pane's session at some other, possibly stale, snapshot.
- `ClientName` (method): ClientName returns the observation's own control client identity - the name a listing of attached clients must exclude, the same way it already excludes a caller's long-lived command connection, so a caller's own stream never reads as another person watching.
- `Baseline` (method): Baseline returns an owned copy of the pane's visible text at the observation boundary.
- `NextNotification` (method): NextNotification returns the next notification strictly after the pane baseline, from the whole connection rather than this pane alone. Notifications queued before that boundary are discarded. Concurrent calls are serialized. Caller context errors and [ControlNotificationError] affect only one call. Explicit close returns an error matching [os.ErrClosed].
- `Close` (method): Close stops the dedicated control client. It is safe to call more than once.
- `CloseContext` (method): CloseContext starts idempotent observation shutdown and waits within ctx.
- `Reader` (method): Reader returns the pane's output after the baseline as a byte stream: what the program in the pane writes to its terminal, in order, and nothing from any other pane on the connection. Reads block until the pane writes, ctx ends, or the observation closes. A lost observation ends the stream with [ErrPaneObservationLost] rather than [io.EOF]. The bytes are the terminal's: escape sequences and carriage returns arrive as written, and the echo of what is typed into the pane arrives before the reply, as it does on screen. Exactly one reader or direct notification read may run at a time.
- `Notifications` (method): Notifications returns [PaneObservation.NextNotification] as a range loop; exactly one iterator or direct read may run at a time. Malformed notifications yield their error and iteration continues; every other error ends the loop after being yielded.
- `WaitFor` (method): WaitFor reads what the pane writes after the observation's baseline and calls match with all of it each time the pane writes, until match reports true, ctx ends, or the observation is lost. It returns the text match accepted, or what was read before the error. tmux pushes each write as it happens, so nothing is polled.
