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-ts latest

Server.watch

Stream tmux's control-mode notifications until the stream is disposed.

Source and package
Qualified name
Server.watch
Module
server
Declared in
Server
Package
libtmux
Source
packages/libtmux/src/server.ts

Description#

A snapshot answers what is true now; this answers what changed. The stream holds one tmux -C attach-session process for its lifetime, so it reports events without polling and without a command per read. That process is a tmux-visible attached client until the stream closes; it affects client listings, attachment state, hooks, and related policy.

tmux sends a control client no pane output until it attaches, so this attaches to a session; a server with no sessions has nothing to watch.

Name that session with target when reading pane output. Structural notifications reach the client wherever it attached, but output arrives only for the attached session, and an untargeted watch lands on whichever session tmux considers current. With two sessions on the server that is silence rather than an error.

Examples#

await using events = server.watch();
for await (const event of events) {
if (event.kind === "window-add") console.log(event.windowId);
}
Parameters

Guides#

Pages that discuss watch.

Esc

Type to search.

Reference previewOpen reference