# `MingaEditor.State.Windows`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/state/windows.ex#L1)

Groups window-related fields from EditorState.

Tracks the window tree layout, the map of window structs, the active
window id, and the next available window id for splits.

# `t`

```elixir
@type t() :: %MingaEditor.State.Windows{
  active: MingaEditor.Window.id(),
  map: %{required(MingaEditor.Window.id()) =&gt; MingaEditor.Window.t()},
  next_id: MingaEditor.Window.id(),
  tree: MingaEditor.WindowTree.t() | nil
}
```

# `active_struct`

```elixir
@spec active_struct(t()) :: MingaEditor.Window.t() | nil
```

Returns the active window struct, or nil if no windows are initialized.

# `popup_windows`

```elixir
@spec popup_windows(t()) :: [{MingaEditor.Window.id(), MingaEditor.Window.t()}]
```

Returns all popup windows as a list of `{window_id, window}` tuples.

Popup windows are those with a non-nil `popup_meta` field.

# `split?`

```elixir
@spec split?(t()) :: boolean()
```

Returns true if the window tree contains a split.

# `update`

```elixir
@spec update(t(), MingaEditor.Window.id(), (MingaEditor.Window.t() -&gt;
                                        MingaEditor.Window.t())) :: t()
```

Updates the window struct for the given window id.

Applies the given function to the window and stores the result.
Returns the struct unchanged if the id is not found.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
