tmux
offers a textual interface called control mode. This allows
applications to communicate with tmux
using a simple text-only
protocol.
In control mode, a client sends tmux
commands or command sequences
terminated by newlines on standard input. Each command will
produce one block of output on standard output. An output block
consists of a %begin line followed by the output (which may be
empty). The output block ends with a %end or %error. %begin and
matching %end or %error have three arguments: an integer time (as
seconds from epoch), command number and flags (currently not used).
For example:
%begin 1363006971 2 1
0: ksh* (1 panes) [80x24] [layout b25f,80x24,0,0,2] @2 (active)
%end 1363006971 2 1
The refresh-client -C
command may be used to set the size of a
client in control mode.
In control mode, tmux
outputs notifications. A notification will
never occur inside an output block.
The following notifications are defined:
%client-detached
client
The client has detached.
%client-session-changed
client session-id name
The client is now attached to the session with ID
session-id, which is named name.
%continue
pane-id
The pane has been continued after being paused (if the
pause-after flag is set, see refresh-client -A
).
%exit
[reason]
The tmux
client is exiting immediately, either because it
is not attached to any session or an error occurred. If
present, reason describes why the client exited.
%extended-output
pane-id age ... : value
New form of %output
sent when the pause-after flag is set.
age is the time in milliseconds for which tmux had buffered
the output before it was sent. Any subsequent arguments up
until a single ':' are for future use and should be
ignored.
%layout-change
window-id window-layout window-visible-layout
window-flags
The layout of a window with ID window-id changed. The new
layout is window-layout. The window's visible layout is
window-visible-layout and the window flags are
window-flags.
%output
pane-id value
A window pane produced output. value escapes non-printable
characters and backslash as octal \xxx.
%pane-mode-changed
pane-id
The pane with ID pane-id has changed mode.
%pause
pane-id
The pane has been paused (if the pause-after flag is set).
%session-changed
session-id name
The client is now attached to the session with ID
session-id, which is named name.
%session-renamed
name
The current session was renamed to name.
%session-window-changed
session-id window-id
The session with ID session-id changed its active window to
the window with ID window-id.
%sessions-changed
A session was created or destroyed.
%subscription-changed
name session-id window-id window-index
pane-id ... : value
The value of the format associated with subscription name
has changed to value. See refresh-client -B
. Any
arguments after pane-id up until a single ':' are for
future use and should be ignored.
%unlinked-window-add
window-id
The window with ID window-id was created but is not linked
to the current session.
%window-add
window-id
The window with ID window-id was linked to the current
session.
%window-close
window-id
The window with ID window-id closed.
%window-pane-changed
window-id pane-id
The active pane in the window with ID window-id changed to
the pane with ID pane-id.
%window-renamed
window-id name
The window with ID window-id was renamed to name.