# LibTmux.TmuxHooks.SetAsync

- **Module:** LibTmux.TmuxHooks
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/320dc64f4b8b7815842471327a5e6b84a1499bf8/src/LibTmux/Hooks/TmuxHooks.cs#L239
- **Page:** https://libtmux.org/en/dotnet/latest/reference/libtmux-tmuxhooks-setasync/

```
LibTmux.TmuxHooks.SetAsync(request: SetHookRequest, cancellationToken: CancellationToken) -> Task<TmuxHook>
```

Sets one hook entry.

## Parameters

- `request` (SetHookRequest): Which hook to set, to what, and how.
- `cancellationToken` (CancellationToken): Cancels the tmux commands.

## Returns

The hook as tmux holds it afterwards.

## Raises

- `TmuxOptionException`: tmux rejected the hook or its command.
