libtmux Reference MCP Search
On this page

server.Server.connect

View as Markdown

Module
server
Declared in
Server
Package
@libtmux/libtmux
Source
packages/libtmux/src/server.ts
connect ( options : : ConnectOptions ) Promise<ConnectedServer>
methodasync [source]
methodasync [source]
connect

Bind this server to one control-mode connection and return it.

The returned server has the same API and shares one control connection for events and daemon-lifetime tracking. Commands use ordinary tmux processes: control mode cannot frame arbitrary command output truthfully when aliases and waiting commands are allowed. The connection has the attached-client lifecycle described by watch until it closes.

Each snapshot acquisition remains one atomic tmux invocation containing its daemon identity read and all four listings. The first connected snapshot also follows the observer authentication and version probes.

Examples

await using live = await server.connect();
for await (const event of live.subscribe()) {
  if (event.kind === "window-add") console.log((await live.snapshot()).windows.count());
}

Discussed in Control mode vs one-shot

0 declared, 0 inherited

Esc

Type to search.