Clients

  • Attached terminals connected to a tmux server

  • Each client has its own view of the active session, window, and pane

  • Identified by client_name (the path or label tmux assigns at attach time)

class libtmux.Client
class libtmux.Client

Bases: Obj

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.

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.

Parameters:

server (Server)

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.