# session.Session.setHook

- **Module:** session.Session
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/session.ts#L171
- **Page:** https://libtmux.org/reference/ts/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 });
```
