Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

method libtmux latest

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
Perlmethod Erlang PowerShell Julia Elixir Haskell Common Lisp RubyLuaTypeScriptRustGoJavaC#C++SwiftKotlinScalaOCaml F# Clojure
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#

The tmux commands behind new_window.

tmux C API#

The C declarations in tmux that implement these commands.

In other ports#

Create a window

Equivalents of Create a window in other languages
Language Equivalent
Ruby LibTmux::Session#new_window
Lua libtmux.Session:new_window
Erlang tmux_window:create/2
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript session.Session.newWindow
Rust session.Session.new_window
Go tmux.Session.NewWindow
Java io.github.libtmux.Session.newWindow
Clojure libtmux.core/new-window!
Kotlin io.github.libtmux.kotlin.Session.newWindow
Scala io.github.libtmux.scaladsl.Session.newWindow
C# LibTmux.Session.CreateWindowAsync
C++ libtmux::Session::new_window
Swift Server.newWindow(in:named:startDirectory:at:environment:shell:)
OCaml Libtmux_unix.Client.create_window
Perl LibTmux::Server::new_window Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes.

No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp or F#.

Esc

Type to search.

Reference previewOpen reference