# pane.Pane.set_hook

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

```
pane.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::typed_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.
