Session.newWindow
Creates a window in this session and returns that exact window.
Source and package
- Qualified name
-
io.github .libtmux .scaladsl .cats .Session. new Window - Package
- io.github.libtmux.scaladsl.cats
- Declared in
Session- 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: Session[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. newWindow(name: String): F[Window[F]]Scala extension methodsAdds methods callable on the receiver type without changing its definition. [F[_]](self: Session[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. newWindow( configure: io.github => Unit ): F[Window[F]].libtmux .Window Spec .Builder Scala extension methodsAdds methods callable on the receiver type without changing its definition. [F[_]](self: Session[F])(using F: _root_.cats [F] ).effect .Async Scala method declarationsDeclares a method, with its name, parameter lists and return type. newWindow(spec: io.github ): F[ Window[F] ].libtmux .Window Spec -
- Type parameters
- Parameters
-
-
configure(io.github => Unit) for.libtmux .Window Spec .Builder newWindow(configure) -
spec(io.github ) for.libtmux .Window Spec newWindow(spec)
Examples
Create a window and read the updated session. 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/NewWindow.scala. It starts a private tmux server of its own and stops it when the program closes it. View sourcesrc/main/scala/NewWindow.scalaComplete program package io.github.libtmux.examples.api.scalacatsimport io.github.libtmux.{SessionSpec, SplitSpec, WindowSpec}import io.github.libtmux.scaladsl.cats.*import _root_.cats.effect.{ExitCode, IO, IOApp}import _root_.cats.syntax.all.*/** Create a window and read the updated session. */object NewWindow extends IOApp {def run(args: List[String]): IO[ExitCode] = {val program = Server.start[IO]().use { server =>for {workOne <- server.newSession(SessionSpec.builder().named("work-one").firstWindowNamed("editor").running("/bin/cat").build())_ <- workOne.windows.head.split(SplitSpec.builder().toRight().running("/bin/cat").build())_ <- workOne.newWindow(WindowSpec.builder().named("logs").running("/bin/cat").detached().build())_ <- server.newSession(SessionSpec.builder().named("work-two").firstWindowNamed("editor").running("/bin/cat").build())found <- server.session("work-one")session <- IO.fromOption(found)(new IllegalStateException("missing work-one"))window <- session.newWindow(WindowSpec.builder().named("api-window").running("/bin/cat").build())_ <- IO.println(s"created=${window.name}")updated <- server.session("work-one")refreshed <- IO.fromOption(updated)(new IllegalStateException("missing work-one"))_ <- IO.println("windows=" + refreshed.windows.map(_.name).sorted.mkString(","))} 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.NewWindow && \build/install/api-example/bin/api-exampleExpected output:
created=api-windowwindows=api-window,editor,logs
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.Session.newWindow.
tmux command
task materialThe tmux commands behind newWindow.
tmux C API
task materialThe C declarations in tmux that implement these commands.
In other ports
task equivalence 16 other ports mappedSource-verified mappings for Create a window. 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 window in this session and returns that exact window. | This page |
| Python | libtmux Create new window, returns new Window. | 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 physical window in the session's next free index and observe it. Defaults to detached. Launch, cwd and environment follow tmux_session:create/2. Performs I/O and retains completed-mutation details if observation fails. | free function |
| TypeScript | session Create a window in this session and resolve it as a handle. | None recorded in the model |
| Rust | session Create a window in this session and return it. | async |
| Go | tmux NewWindow creates a winlink in the receiver session. Attach selects it as that session's current window; it is not a guarantee about clients attached to other sessions. The returned Window is freshly materialized in the receiver's exact session context, including when its stable WindowID is linked elsewhere. | None recorded in the model |
| Java | io Creates a window in this session and returns that exact window. | None recorded in the model |
| Clojure | libtmux Creates a window and returns a fresh captured window occurrence. | free function |
| Kotlin | io Creates a window in this session and returns that exact window. | async |
| C# | Lib Creates a window in this session. | async |
| C++ | libtmux:: Created detached: a library call that stole the terminal would be a surprise, and attaching is a separate decision. | readonly |
| Swift | Server Creates a window in a session and returns its exact appearance. | asyncon Server |
| OCaml | Libtmux Create detached, rejecting an occupied explicit index. | free function |
| Perl | Lib new_window(session => Session|session_id, name => string?, command => arrayref?, shell_command => string?, cwd => bytes?, environment => hashref?). | on Server Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |
| Raku | Lib Create a window and return its reported identity without refreshing observations. | on SessionRef |
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#.