Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Python API

Python documentation

libtmux.Window.cmd

Python

View as Markdown

Module
libtmux
Declared in
Window
Package
libtmux
Source
src/libtmux/window.py
Other languages
Ruby Lua TypeScriptRustGo Java .NET C++ Swift
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.

Parameters
  • target ( str | int | None ) – Optional custom target override. By default, the target is the window ID.

Returns

server.cmd

In other ports Run a tmux command addressed at a window
  • Ruby No source-verified Ruby equivalent is recorded for this operation.
  • Lua No source-verified Lua equivalent is recorded for this operation.
  • TypeScript window.Window.cmd
  • Rust window.Window.cmd
  • Go tmux.Window.Cmd
  • Java no equivalent on Window
  • .NET no equivalent on Window
  • C++ no equivalent on Window
  • Swift no equivalent on Window

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_...)))
await window.cmd("rotate-window");
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("raw").await?;
let window = session.active_window().await?.expect("a window");
let result = window
.cmd(libtmux::Command::new("display-message").arg("-p").arg("#{window_id}"))
.await?;
assert_eq!(result.stdout_lossy().trim(), window.id().to_string());
guard.shutdown().await?;

0 declared, 0 inherited

Esc

Type to search.