# tmux.Session.KillWindow

- **Module:** tmux.Session
- **Package:** github.com/libtmux/libtmux-go/tmux
- **Language:** Go
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-go/blob/5f808882015a975a65acc7f9da5b3ff0d5cbdc91/tmux/lifecycle_kill.go#L169
- **Page:** https://libtmux.org/reference/go/tmux-session-killwindow/

```
tmux.Session.KillWindow(ctx: context.Context, request: KillWindowRequest) -> error
```

KillWindow destroys one stable window. When Target and Index are nil it selects the receiver session's current window, and Index selects a winlink in that session. A nonnil Target is forwarded as unrestricted tmux target syntax and may select a window in another session. The selected stable window is removed from every session and its panes are destroyed. Affected sessions preserve their current selection unless this window was current, in which case they select another. A session left without windows is destroyed; [Session.Kill] describes how tmux handles its clients.

Target and Index are mutually exclusive. The receiver is not refreshed. Only
stderr makes a completed command a [CommandError]; nonzero exits without
stderr are ignored. Transport errors are delivery-ambiguous.
