# tmux_window:create/2

- **Package:** libtmux_erlang
- **Language:** Erlang
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-erlang/blob/d1b6308440cf9eb8f6647e7ae434bce60e849368/apps/libtmux_erlang/src/tmux_window.erl#L41
- **Page:** https://libtmux.org/en/erlang/latest/reference/tmux_window-create-2/

```
create(Session, Options)
-spec create(tmux_model:session(), create_options()) ->
                {ok, tmux_model:window()} | {error, map()}.
```

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.

## Parameters

- `Session` (`tmux_model:session()`)
- `Options` (`create_options()`)

## tmux command

The tmux commands behind `create/2`.

- [`new-window`](/en/tmux/latest/manual/new-window/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_new_window_entry`](/en/tmux/latest/reference/c-variable-cmd_new_window_entry/) (attribute)
- [`cmd_new_window_exec`](/en/tmux/latest/reference/c-function-cmd-new-window-c-cmd_new_window_exec/) (function)

## In other ports

Create a window

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Session.new_window`](/en/py/latest/reference/libtmux-session-new_window/) (method) |
| Ruby | [`LibTmux::Session#new_window`](/en/ruby/latest/reference/libtmux-session-new_window/) (method) |
| Lua | [`libtmux.Session:new_window`](/en/lua/latest/reference/libtmux-session-new_window/) (method) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`session.Session.newWindow`](/en/ts/latest/reference/session-session-newwindow/) (method) |
| Rust | [`session.Session.new_window`](/en/rs/latest/reference/session-session-new_window/) (method) |
| Go | [`tmux.Session.NewWindow`](/en/go/latest/reference/tmux-session-newwindow/) (method) |
| Java | [`io.github.libtmux.Session.newWindow`](/en/java/latest/reference/io-github-libtmux-session-session-newwindow/) (method) |
| Clojure | [`libtmux.core/new-window!`](/en/clojure/latest/reference/libtmux-core-new-window/) (function) |
| Kotlin | [`io.github.libtmux.kotlin.Session.newWindow`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-session-newwindow/) (method) |
| Scala | [`io.github.libtmux.scaladsl.Session.newWindow`](/en/scala/latest/reference/io-github-libtmux-scaladsl-session-newwindow/) (method) |
| C# | [`LibTmux.Session.CreateWindowAsync`](/en/csharp/latest/reference/libtmux-session-createwindowasync/) (method) |
| C++ | [`libtmux::Session::new_window`](/en/cxx/latest/reference/libtmux-session-new_window/) (method) |
| Swift | [`Server.newWindow(in:named:startDirectory:at:environment:shell:)`](/en/swift/latest/reference/server-newwindow(in-named-startdirectory-)/) (method) |
| OCaml | [`Libtmux_unix.Client.create_window`](/en/ocaml/latest/reference/libtmux_unix-client-create_window/) (function) |
| Perl | [`LibTmux::Server::new_window`](/en/perl/latest/reference/libtmux-server-new_window/) (method). Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |

No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp or F#.
