# pane.settings.Pane.set_hook

- **Module:** pane.settings.Pane
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/pane/settings.rs#L144
- **Page:** https://libtmux.org/reference/rs/pane-settings-pane-set_hook/

```
pane.settings.Pane.set_hook(self, name: &str, command: impl Into<OsString>) -> Result<(), Error>
```

Set one hook to a tmux command.

Hooks live in the same option tables, so a hook is an array option and
[`Self::get_option`] reads it under an indexed name such as
`after-new-window[0]`.

# Errors

Returns an error when tmux rejects the hook name or command.

Returns [`crate::Error::OptionScopeMismatch`] when tmux keeps the
option in another of its tables.
