Core LibrarystableAPI Reference

Choose documentation 3

stable

Current version

stable
English

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

Python API

method libtmux stable

Window.new_window

Create new window respective of current window's position.

Source and package
Qualified name
libtmux.Window.new_window
Module
libtmux
Declared in
Window
Package
libtmux
Source
src/libtmux/window.py
new_window ( self, window_name: str | None = None, start_directory: None = None, attach: bool = False, window_index: str = "", window_shell: str | None = None, environment: dict[str, str] | None = None, direction: WindowDirection | None = None, ) → Window

Examples#

>>> window_initial = session.new_window(window_name='Example')
>>> window_initial
Window(@... 2:Example, Session($1 libtmux_...))
>>> window_initial.window_index
'2'
>>> window_before = window_initial.new_window(
... window_name='Window before', direction=WindowDirection.Before)
>>> window_initial.refresh()
>>> window_before
Window(@... 2:Window before, Session($1 libtmux_...))
>>> window_initial
Window(@... 3:Example, Session($1 libtmux_...))
>>> window_after = window_initial.new_window(
... window_name='Window after', direction=WindowDirection.After)
>>> window_initial.refresh()
>>> window_after.refresh()
>>> window_after
Window(@... 4:Window after, Session($1 libtmux_...))
>>> window_initial
Window(@... 3:Example, Session($1 libtmux_...))
>>> window_before
Window(@... 2:Window before, Session($1 libtmux_...))
Esc

Type to search.

Reference preview Open reference