Tmux

Represents tmux integration objects.

async async_get_tmux_connections(connection: iterm2.connection.Connection) → List[iterm2.tmux.TmuxConnection]

Fetches a list of tmux connections.

This may not be called from within a Transaction.

Parameters

connection (Connection) – The connection to iTerm2.

Returns

The current tmux connections.

See also

Example “Tmux Integration

async async_get_tmux_connection_by_connection_id(connection: iterm2.connection.Connection, connection_id: str) → Optional[iterm2.tmux.TmuxConnection]

Find a tmux connection by its ID.

Parameters
Returns

Either a TmuxConnection or None.

class TmuxException

A problem was encountered in a Tmux request.

class TmuxConnection(connection_id, owning_session_id, delegate)

A tmux integration connection.

Do not create this yourself. Use async_get_tmux_connections(), instead.

async async_create_window() → iterm2.window.Window

Creates a new tmux window.

This may not be called from within a Transaction.

Returns

A new Window.

See also

Example “Tmux Integration

async async_send_command(command: str) → str

Sends a command to the tmux server.

This may not be called from within a Transaction.

Return type

str

Parameters

command (str) – The command to send to tmux (e.g., “list-sessions”)

Returns

The command’s output as a string.

Throws TmuxException

If the command fails for any reason or the RPC fails such as from an invalid ID.

See also

Example “Tile tmux Window Panes

async async_set_tmux_window_visible(tmux_window_id: str, visible: bool) → None

Hides or shows a tmux window.

Tmux windows are represented as tabs in iTerm2. You can get a tmux_window_id from tmux_window_id(). If this tab is attached to a tmux session, then it may be hidden.

This may not be called from within a Transaction.

Parameters
  • tmux_window_id (str) – The window to show or hide.

  • visible (bool) – True to show a window, False to hide a window.

property connection_id

Returns the unique identifier of the connection.

Returns

A connection ID, which is also a human-readable description of the connection.

property owning_session

Returns the “gateway” session.

Returns

The Session where tmux -CC was run, or None if it cannot be found.


Indices and tables