libtmux Reference MCP Search
On this page

libtmux.Window.cmd

View as Markdown

Module
libtmux
Declared in
Window
Package
libtmux
Source
src/libtmux/window.py
cmd ( self , cmd : str , args : t.Any , target : str | int | None = None ) tmux_cmd
method [source]
method [source]
cmd

Execute tmux subcommand within window context.

Automatically binds target by adding -t for object's window ID to the command. Pass target to keyword arguments to override.

Examples

Create a pane from a window:

>>> window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0]
'%...'

Magic, directly to a Pane :

>>> Pane.from_pane_id(pane_id=session.cmd(
... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=session.server)
Pane(%... Window(@... ...:..., Session($1 libtmux_...)))
Parameters
  • target ( str | int | None ) – Optional custom target override. By default, the target is the window ID.

Returns

server.cmd

0 declared, 0 inherited

Esc

Type to search.