libtmux Reference MCP Search
On this page

tmux.Server.NewSession

View as Markdown

Module
tmux
Declared in
Server
Package
github.com/libtmux/libtmux-go/tmux
Source
tmux/session_lifecycle.go
Other languages
PythonTypeScriptRustJava.NETC++Swift
NewSession ( ctx : context.Context , request : NewSessionRequest ) (Session, error)
method [source]
method [source]
NewSession

NewSession creates a detached session, then returns a newly materialized Session . It never changes client focus. KillExisting is not rolled back; transport and context failures may be delivery-ambiguous.

The returned record has unmaterialized Session.Windows and Session.Panes relations. Use the resolvers or Server.Snapshot when relations are needed.

If tmux reports an ID before a transport or refresh failure, the returned partial Session contains its Server and SessionID . Other failures return zero.

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

Esc

Type to search.