# session.settings.Session.hooks

- **Module:** session.settings.Session
- **Package:** libtmux
- **Language:** Rust
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-rs/blob/8a648c0894dfffc9303583f753b6c8ae01f2fe76/crates/libtmux/src/session/settings.rs#L263
- **Page:** https://libtmux.org/reference/rs/session-settings-session-hooks/

```
session.settings.Session.hooks(self) -> Result<BTreeMap<String, IndexedHooks>, Error>
```

Read every hook set at this session.

Only hooks holding something are reported: tmux lists every hook name
it knows, and the ones holding nothing are absent here rather than
present and empty.

# Errors

Returns an error when tmux cannot be reached or refuses the listing.

## Example

```rust
let guard = libtmux::test::TestServer::new().await?;
let session = guard.server().new_session("hooked").await?;

session.set_hook("alert-bell", "display-message rang").await?;
let hooks = session.hooks().await?;
assert!(hooks.contains_key("alert-bell"));

guard.shutdown().await?;
```
