# libtmux._internal.constants.Hooks.from_stdout

- **Module:** libtmux._internal.constants.Hooks
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/_internal/constants.py#L1097
- **Page:** https://libtmux.org/reference/py/libtmux-_internal-constants-hooks-from_stdout/

```
libtmux._internal.constants.Hooks.from_stdout(cls, value: list[str]) -> Hooks
```

Parse raw tmux hook output into a Hooks instance.

The parsing pipeline:

1. ``parse_options_to_dict()`` - Parse "key value" lines into dict
2. ``explode_arrays(force_array=True)`` - Extract array indices into SparseArray
3. ``explode_complex()`` - Handle complex option types
4. Rename keys: ``session-renamed`` → ``session_renamed``

## Parameters

- `cls`
- `value` (list[str]) — Raw tmux output lines from ``show-hooks`` command.

## Returns

Hooks
    Parsed hooks with SparseArray fields for each hook type.

## Example

Basic parsing:

```python
>>> from libtmux._internal.constants import Hooks
```

## Example

```python
>>> raw = ["session-renamed[0] display-message 'renamed'"]
>>> hooks = Hooks.from_stdout(raw)
>>> hooks.session_renamed[0]
"display-message 'renamed'"
```

## Example

The pipeline preserves sparse indices:

```python
>>> raw = [
...     "after-select-window[0] refresh-client",
...     "after-select-window[10] display-message 'selected'",
... ]
>>> hooks = Hooks.from_stdout(raw)
>>> sorted(hooks.after_select_window.keys())
[0, 10]
```

## Example

Empty input returns empty SparseArrays:

```python
>>> hooks_empty = Hooks.from_stdout([])
>>> len(hooks_empty.session_renamed)
0
>>> hooks_empty.session_renamed.as_list()
[]
```
