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
- watch(options?: Watch
Options ): TmuxEvent Stream -
Description#
A snapshot answers what is true now; this answers what changed. The stream holds one
tmux -C attach-sessionprocess 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
targetwhen 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
-
-
options? (WatchOptions ) #
-
Guides#
Pages that discuss watch.