# tmux.NewWindowRequest

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

NewWindowRequest configures window creation on tmux 3.2a or later. Its zero value uses inherited defaults; placement behavior depends on the receiver. [Session.NewWindow] uses tmux's next free index. [Window.NewWindow] instead targets the receiver's occupied index and normally returns a command error; KillExisting may replace it. [Window.NewWindow] rejects Index. SelectExisting may run name-expansion probes before creation.

Pointer fields are explicit when nonnil. Methods copy them and Environment
before I/O; concurrent mutation during the copy is unsafe.

## Members

- `Name` (attribute) — Name is omitted when nil. A nonnil empty string remains an explicit -n operand. The value is copied before tmux is called.
- `Attach` (attribute) — Attach lets the created or selected winlink become current in the target session; false preserves its current window.
- `Index` (attribute) — Index selects an explicit nonnegative winlink index for Session.NewWindow; nil uses the next free index.
- `StartDirectory` (attribute) — StartDirectory expands ~ and ~/... for the current user. Named-user forms such as ~other are rejected; empty inherits tmux's default.
- `Command` (attribute) — Command starts the window with this shell command; empty uses tmux's default command.
- `Environment` (attribute) — Environment is emitted in lexically sorted key order. The map is not retained; nil and an empty map both add no entries.
- `Direction` (attribute) — Direction places the new winlink relative to the target. Its zero value uses tmux's next free index with Session.NewWindow when Index is nil, but keeps Window.NewWindow on the receiver's occupied target. Use NewWindowDirectionAfter or NewWindowDirectionBefore for non-destructive relative creation through Window.NewWindow.
- `KillExisting` (attribute) — KillExisting asks tmux to destroy a window occupying the target index.
- `SelectExisting` (attribute) — SelectExisting asks tmux to select an existing expanded-name match instead of creating another window. It requires Name.
