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

Session.new_window

Create new window, returns new Window .

Source and package
Qualified name
libtmux.Session.new_window
Module
libtmux
Declared in
Session
Package
libtmux
Source
src/libtmux/session.py
Other languages
PowerShell Julia RubyLuaTypeScriptRustGoJavaC#C++SwiftKotlinScala F#
new_window
( 11 parameters ) ( self, window_name: str | None = None, start_directory: StrPath | None = None, attach: bool = False, window_index: str = "", window_shell: str | None = None, environment: dict[str, str] | None = None, direction: WindowDirection | None = None, target_window: str | None = None, kill_existing: bool | None = None, select_existing: bool | None = None, )
→ Window

Description#

By default, this will make the window active. For the new window to be created and not set to current, pass in attach=False.

Examples#

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

Window The newly created window.

tmux command new-window

In other ports Create a window
Esc

Type to search.

Reference preview Open reference