# server.NewSessionOptions

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

Options for creating a session.

A bare name is accepted wherever this is, so the common case stays short:
`server.new_session("work")`.

## Example

```rust
use libtmux::NewSessionOptions;

let guard = libtmux::test::TestServer::new().await?;
let server = guard.server();

let session = server
    .new_session(NewSessionOptions::new("work").window_name("editor"))
    .await?;

let window = session.active_window().await?.expect("a session has a window");
assert_eq!(window.name().to_string_lossy(), "editor");

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

## Members

- `new` (method): Describe a session with the given name.
- `start_directory` (method): Set the working directory for the session's first window.
- `window_name` (method): Name the session's first window, literally.
- `command` (method): Run a command instead of the default shell.
- `environment` (method): Set an environment variable for the process the new session starts.
- `size` (method): Set the initial size, which a detached session would otherwise default.
