NewWindowRequest
NewWindowRequest configures window creation on tmux 3.3a 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.
Source and package
- Qualified name
-
tmux.New Window Request - Package
- tmux
- Distribution
- github.com/libtmux/libtmux-go/tmux
- Source
- tmux/window_lifecycle.go
-
Description#
Pointer fields are explicit when nonnil. Methods copy them and Environment before I/O; concurrent mutation during the copy is unsafe.
Fields9#
| Name | Type | Description |
|---|---|---|
| Attach | bool | Attach lets the created or selected winlink become current in the target session; false preserves its current window. |
| Command | string | Command starts the window with this shell command; empty uses tmux's default command. |
| Direction | New | 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. |
| Environment | map[string]string | Environment is emitted in lexically sorted key order. The map is not retained; nil and an empty map both add no entries. |
| Index | *int | Index selects an explicit nonnegative winlink index for Session.NewWindow; nil uses the next free index. |
| KillExisting | bool | KillExisting asks tmux to destroy a window occupying the target index. |
| Name | *string | Name is omitted when nil. A nonnil empty string remains an explicit -n operand. The value is copied before tmux is called. |
| SelectExisting | bool | SelectExisting asks tmux to select an existing expanded-name match instead of creating another window. It requires Name. |
| StartDirectory | string | StartDirectory expands ~ and ~/... for the current user. Named-user forms such as ~other are rejected; empty inherits tmux's default. A directory that does not exist is not an error: tmux starts the process in the home directory instead, or in / without one. |