# window.Window.rename

- **Module:** window.Window
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/window.rs#L377
- **Page:** https://libtmux.org/reference/rs/window-window-rename/

```
window.Window.rename(mut, name: impl Into<OsString>) -> Result<&mut Self, Error>
```

Rename the window and update this handle.

The name belongs to the window, so every session linking it sees the
change.

# Errors

Returns an error when tmux refuses the name.
tmux expands the name as a format before it checks it, so `#(command)`
in one runs a shell command. See [the crate documentation][crate#a-name-reaches-tmux-as-a-format]
before passing text a caller supplied.
