# session.Session.setHook

- **Module:** session.Session
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/3fe1ca654b81b8cbf4a13b777a001a3298c87a6f/packages/libtmux/src/session.ts#L172
- **Page:** https://libtmux.org/en/ts/latest/reference/session-session-sethook/

```
session.Session.setHook(name: : string, command: : string, options: : SetHookOptions) -> Promise<void>
```

Bind a tmux command to a hook on this session.

A hook holds a list of commands. Without `append` this writes the whole
list, so it replaces whatever the hook already ran.

## Example

```ts
await session.setHook("window-linked", "display-message 'linked'");
await session.setHook("window-linked", "display-message 'twice'", { append: true });
```
