# tmux.NewSessionRequest

- **Module:** tmux
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/session_lifecycle.go#L36
- **Page:** https://libtmux.org/reference/go/tmux-newsessionrequest/

NewSessionRequest configures session creation. [Server.NewSession] creates a detached session; [Server.NewSessionConnection] creates one attached to its first control-mode lane. Its zero value uses tmux defaults. Width and Height are either zero or 1 through 65535; KillExisting requires Name. KillExisting may remove a session before a later creation failure.

[Server.NewSession] copies Environment before validation and retains no map
storage; concurrent mutation during the copy is unsafe. Foreground-only tmux
flags are not exposed.

## Members

- `Name` (attribute) — Name selects the new session name; empty lets tmux generate one.
- `KillExisting` (attribute) — KillExisting removes an existing session named Name before creation.
- `StartDirectory` (attribute) — StartDirectory expands ~ and ~/... for the current user. Named-user forms such as ~other are rejected; empty inherits tmux's default.
- `WindowName` (attribute) — WindowName names the initial window; empty lets tmux choose.
- `Width` (attribute) — Width sets the detached session width; zero lets tmux choose.
- `Height` (attribute) — Height sets the detached session height; zero lets tmux choose.
- `Environment` (attribute) — Environment is emitted in lexically sorted key order. The map is not retained; nil and an empty map both add no entries.
- `Command` (attribute) — Command starts the initial pane with this shell command; empty uses tmux's default command.
