# session.NewWindowOptions

- **Module:** session
- **Package:** libtmux
- **Language:** Rust
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-rs/blob/f0e37052c232636b61d095817046e6bfc8f2ca40/crates/libtmux/src/session.rs#L981
- **Page:** https://libtmux.org/en/rs/latest/reference/session-newwindowoptions/

Options for creating a window in a session.

A bare name is accepted wherever this is: `session.new_window("editor")`.

## Example

```rust
use libtmux::NewWindowOptions;

let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("work").await?;

let window = session
    .new_window(NewWindowOptions::new("editor").environment("EDITOR", "vi"))
    .await?;
assert_eq!(window.name().to_string_lossy(), "editor");

// A bare name works too, because `new_window` takes anything that converts.
session.new_window("logs").await?;
assert_eq!(session.windows().await?.len(), 3);

guard.shutdown().await?;
```

## Members

- `unnamed` (method): Describe a window with no name, letting tmux choose one.
- `new` (method): Describe a window with the given name, sent literally.
- `start_directory` (method): Set the window's working directory.
- `command` (method): Run a command instead of the default shell.
- `index` (method): Place the window at a window index rather than the first free one.
- `placement` (method): Insert relative to the index rather than at it.
- `environment` (method): Set an environment variable for the process the new window starts.
- `replace_existing` (method): Replace whatever already occupies the target index.
- `select` (method): Make the new window active in its session.
