Server.newSession
Creates a detached session and returns that exact session.
Source and package
- Qualified name
-
io.github .libtmux .scaladsl .cats .Server. new Session - Package
- io.github.libtmux.scaladsl.cats
- Declared in
Server- Distribution
- io.github.libtmux:libtmux-scala_3
- Source
- libtmux-scala-cats/build/generated/sources/catalog/scala/operations/GeneratedOperations.scala
-
Scala extension methodsAdds methods callable on the receiver type without changing its definition. [F[_]](self: Server[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. newSession(name: String): F[Session[F]]Scala extension methodsAdds methods callable on the receiver type without changing its definition. [F[_]](self: Server[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. newSession( configure: io.github => Unit ): F[Session[F]].libtmux .Session Spec .Builder Scala extension methodsAdds methods callable on the receiver type without changing its definition. [F[_]](self: Server[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. newSession(spec: io.github ): F[ Session[F] ].libtmux .Session Spec -
- Type parameters
- Parameters
-
-
configure(io.github => Unit) for.libtmux .Session Spec .Builder newSession(configure) -
spec(io.github ) for.libtmux .Session Spec newSession(spec)
Examples
Create a session running cat. Use JDK 25, Gradle 9 or newer, and tmux 3.3a or newer on Linux, with
/bin/catand/bin/shavailable. In an empty directory, save this consumer setup assettings.gradle.kts:rootProject.name = "api-example"Save this consumer setup as
build.gradle.kts. It depends on the 0.1.2 release from Maven Central:plugins {scalaapplication}repositories { mavenCentral() }dependencies {implementation("io.github.libtmux:libtmux-scala-cats_3:0.1.2")implementation("org.scala-lang:scala3-library_3:3.9.0")}java { toolchain { languageVersion.set(JavaLanguageVersion.of(25)) } }application { mainClass.set(providers.gradleProperty("exampleMain")) }Save this consumer setup as
gradle.properties: View sourcegradle.properties org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=768m -Dfile.encoding=UTF-8kotlin.daemon.jvmargs=-Xmx2gorg.gradle.workers.max=2Save this complete program as
src/main/scala/NewSession.scala. It starts a private tmux server of its own and stops it when the program closes it. View sourcesrc/main/scala/NewSession.scalaComplete program package io.github.libtmux.examples.api.scalacatsimport io.github.libtmux.{SessionSpec}import io.github.libtmux.scaladsl.cats.*import _root_.cats.effect.{ExitCode, IO, IOApp}import _root_.cats.syntax.all.*/** Create a session running cat. */object NewSession extends IOApp {def run(args: List[String]): IO[ExitCode] = {val program = Server.start[IO]().use { server =>for {session <- server.newSession(SessionSpec.builder().named("api-session").running("/bin/cat").build())_ <- IO.println(s"created=${session.name}")} yield ()}program.as(ExitCode.Success).handleErrorWith { error =>IO(System.err.println("Example failed: " + error.getMessage)).as(ExitCode.Error)}}}Build the minimal consumer with Gradle and run the saved program. An operation or cleanup error makes the command exit unsuccessfully:
Terminal window $ gradle --console=plain --quiet installDist -PexampleMain=io.github.libtmux.examples.api.scalacats.NewSession && \build/install/api-example/bin/api-exampleExpected output:
created=api-session
Recorded calls
source callsThe Scala reference records declarations, not calls, so this page shows no callers or callees. That is a limit of the extracted data, not a statement that nothing calls io.github.libtmux.scaladsl.cats.Server.newSession.
tmux command
task materialThe tmux commands behind newSession.
tmux C API
task materialThe C declarations in tmux that implement these commands.
Each path starts at a function a command runs, which is degree 1. The degree counts steps from there along the path, and each step is a call or a reference: degree 2 is reached from that function, degree 3 from the next, and so on.
Create a session and its first pane
- 1
cmd_new_session_exec - calls → 2
spawn_window - calls → 3
spawn_pane - calls → 4
window_add_pane - calls → 5
window_pane_create
In other ports
task equivalence 16 other ports mappedSource-verified mappings for Create a session. A mapping says these APIs perform the same task. It does not say they share defaults, errors or completion: check each page.
| Port | API | Differs from Scala |
|---|---|---|
| Scala | io Creates a detached session and returns that exact session. | This page |
| Python | libtmux Create new session, returns new Session. | None recorded in the model |
| Ruby | Lib Behavior: Creation. | None recorded in the model |
| Lua | libtmux | None recorded in the model |
| Erlang | tmux Create a detached session by default and explicitly observe the returned row. Options include name, window_name, dimensions, cwd, env and launch. Performs I/O; an observation failure after successful creation retains mutation = completed and the original command result. Existing names are not adopted. | free function |
| TypeScript | server Create a detached session and resolve it as a handle. | None recorded in the model |
| Rust | server Create a detached session and return it. | async |
| Go | tmux 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. | None recorded in the model |
| Java | io Creates a detached session and returns that exact session. | None recorded in the model |
| Clojure | libtmux Creates a detached session and returns a fresh captured session map. | free function |
| Kotlin | io Creates a detached session and returns that exact session. | async |
| C# | Lib Creates a session. | async |
| C++ | libtmux:: Created detached, and returned, because tmux prints what it made. | readonly |
| Swift | Server Creates a detached session. | async |
| OCaml | Libtmux Create a detached session on the bound daemon. Name collisions fail. | free function |
| Perl | Lib new_session(name => string, command => arrayref?, shell_command => string?, width => integer?, height => integer?, cwd => bytes?, environment => hashref?). | Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |
| Raku | Lib Create a detached session and return its value-only, identity-scoped reference. | None recorded in the model |
No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp or F#.