On this page
io.github.libtmux.Session.Session.newWindow
- Module
- io.github.libtmux.Session
- Declared in
- Session
- Package
- io.github.libtmux:libtmux
- Source
- libtmux/src/main/java/io/github/libtmux/Session.java
- Other languages
- PythonTypeScriptRustGo.NETC++Swift
-
Creates a window in this session and returns that exact window.
<p>The creating command reports which window it made, rather than the name being looked up afterwards: two windows may share a name, and then a lookup cannot say which one is new.
- Returns
-
a handle on the created window, from a fresh capture
- Raises
-
-
UnsupportedTmuxVersion – if the spec asks for something this server does not have
-
In other languages Create a 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 = 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_...)) const created = await session.newWindow({ name: "editor" });
created.name; // "editor" 0 declared, 0 inherited