libtmux Reference MCP Search
On this page

libtmux.Client

View as Markdown

Module
libtmux
Package
libtmux
Source
src/libtmux/client.py
class libtmux.Client
class [source]
class [source]
class libtmux.Client
Bases:

tmux(1) Client [client_manual].

A tmux client is an attached terminal. The same tmux server can have multiple clients attached simultaneously (e.g. $ tmux attach from several terminals) and each receives its own view of the active session, window, and pane.

Examples

>>> with control_mode() as ctl:
...     attached = [
...         c
...         for c in server.clients
...         if c.client_name == ctl.client_name
...     ]
>>> bool(attached)
True
>>> with control_mode() as ctl:
...     client = server.clients.get(client_name=ctl.client_name)
...     client.client_readonly in {"0", "1"}
True

References

[client_manual]

tmux client. openbsd manpage for TMUX(1). "tmux supports multiple attached clients. Each client has its own keymap, view of the session, and message log." https://man.openbsd.org/tmux.1#DESCRIPTION. Accessed 2026.

warning

client_session, session_id, window_id and pane_id are snapshots of the client's *currently attached view* at the moment this object was read — not stable identity for the client. When the client switches sessions via switch-client, moves focus via select-window / select-pane, or detaches, these fields go stale until refresh re-reads them from list-clients. The client_name (tty path on Unix) is the client's stable identity. Prefer attached_session , attached_window , and attached_pane when you need the client's current attachment. Each property re-reads tmux before returning, so the Session / Window / Pane you get back reflects where the client is attached *now*, not where it was when this Client was constructed. If tmux no longer reports this client_name through list-clients, these properties return None. attached_pane follows the attached session's current window. That can differ from the per-client active pane set by select-pane -P; see attached_pane for the exact behavior. Each property re-reads tmux on every access.

7 declared, 179 inherited

Members

Inherited members

Reached through libtmux.neo.Obj.

Esc

Type to search.