On this page
io.github.libtmux.Server.Server.newSession
- Module
- io.github.libtmux.Server
- Declared in
- Server
- Package
- io.github.libtmux:libtmux
- Source
- libtmux/src/main/java/io/github/libtmux/Server.java
- Other languages
- PythonTypeScriptRustGo.NETC++Swift
- newSession ( name : String ) Session ( configure : Consumer<SessionSpec.Builder> ) Session ( spec : SessionSpec ) Session
-
Creates a detached session and returns that exact session.
<p>tmux reports which session it made, so the result is exact even when another session already carries the same name.
<p>Keep
:and.out of the name. tmux decides what to do with them and changes its mind across the supported range: 3.2a through 3.6 rewrite each one to_, 3.7 refuses the name, and 3.7a onwards keeps it — where it then cannot address the session, because a target splits on both.Session#name()reports what tmux settled on.- Raises
-
-
UnsupportedTmuxVersion – if the spec asks for something this server does not have
-
In other languages Create a session
Examples
Sessions can be created without a session name (0.14.2+):
>>> server.new_session()
Session($2 2) Creating them in succession will enumerate IDs (via tmux):
>>> server.new_session()
Session($3 3) With a `session_name`:
>>> server.new_session(session_name='my session')
Session($4 my session) const created = await server.newSession({ name: "work" });
created.name; // "work" 0 declared, 0 inherited