# window.Window.resize_by

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

```
window.Window.resize_by(mut, direction: ResizeDirection, cells: u32) -> Result<&mut Self, Error>
```

Resize the window to an exact size in cells.

# Errors

Returns an error when tmux refuses the size.
Move one edge of the window by a number of cells.

This is the form a keybinding uses: "make it two columns wider" rather
than a size computed from the current one.

# Errors

Returns an error when tmux refuses the resize.

## Example

```rust
use libtmux::ResizeDirection;

let session = server.new_session("resized-window").await?;
let mut window = session.windows().await?.remove(0);

window.resize(80, 24).await?;
window.resize_by(ResizeDirection::Down, 4).await?;
assert_eq!(window.height(), 28);
```
