# LibTmux::WindowSelection

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Perl
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-perl/blob/352715a4fa66a96eed7763b90daaa536aa2f121d/packages/core/lib/LibTmux/WindowSelection.pm#L1
- **Bases:** [`LibTmux::Selection`](/en/perl/latest/reference/libtmux-selection/)
- **Page:** https://libtmux.org/en/perl/latest/reference/libtmux-windowselection/

```
package LibTmux::WindowSelection;
```

Native array selection of captured window entities


## DESCRIPTION

Inherits the fixed-return local query API of [`LibTmux::Selection`](/en/perl/latest/reference/libtmux-selection/). Members must be defined [`LibTmux::Window`](/en/perl/latest/reference/libtmux-window/) handles from one server generation. Empty instances still validate against the window schema. Native array edits are possible; query methods validate membership and never perform tmux I/O.



## Inherited members

- [`count`](/en/perl/latest/reference/libtmux-windowselection-count/) (method), inherited from `LibTmux::Selection`: `count($criteria?)` returns an integer. Empty input returns zero. Validate all members before evaluating the optional criterion; count every matching occurrence, including duplicates.
- [`exists`](/en/perl/latest/reference/libtmux-windowselection-exists/) (method), inherited from `LibTmux::Selection`: `exists($criteria?)` returns a native Boolean. Empty input returns false. After validating the entire membership, stop at the first matching entity. A reference itself remains true even when empty.
- [`first`](/en/perl/latest/reference/libtmux-windowselection-first/) (method), inherited from `LibTmux::Selection`: `first($criteria?)` returns the first matching entity or undef. Input order determines first; after membership validation, later field reads may be skipped.
- [`grep`](/en/perl/latest/reference/libtmux-windowselection-grep/) (method), inherited from `LibTmux::Selection`: `grep($callback)` returns a new same-class selection. Invoke the callback in scalar context with exactly one entity argument and a localized `$_`. Both bindings hold copies of the reference: assignment cannot replace a source slot. Restore `$_` and propagate the original thrown value even on failure. Predicates must not edit the traversed sequence.
- [`iterator`](/en/perl/latest/reference/libtmux-windowselection-iterator/) (method), inherited from `LibTmux::Selection`: Return a fresh local cursor with a copy of current membership. Its `next` returns an entity or undef only at exhaustion. Later native array edits do not alter this traversal; the selection remains replayable.
- [`new`](/en/perl/latest/reference/libtmux-windowselection-new/) (method), inherited from `LibTmux::Selection`: `new(@entities)` creates a concrete blessed array reference and validates every member. Construct an entity-specific selection such as [`LibTmux::PaneSelection`](/en/perl/latest/reference/libtmux-paneselection/); an empty instance retains that schema.
- [`one`](/en/perl/latest/reference/libtmux-windowselection-one/) (method), inherited from `LibTmux::Selection`: `one($criteria?)` returns one entity. Zero throws [`NoMatch`](/en/perl/latest/reference/libtmux-x-nomatch/); a second occurrence throws [`MultipleMatches`](/en/perl/latest/reference/libtmux-x-multiplematches/), reporting at least two and their IDs. Two occurrences of one identity are still ambiguous.
- [`one_or_undef`](/en/perl/latest/reference/libtmux-windowselection-one_or_undef/) (method), inherited from `LibTmux::Selection`: `one_or_undef($criteria?)` returns an entity or undef for absence. A second matching occurrence still throws [`MultipleMatches`](/en/perl/latest/reference/libtmux-x-multiplematches/).
- [`to_array`](/en/perl/latest/reference/libtmux-windowselection-to_array/) (method), inherited from `LibTmux::Selection`: Return a fresh, unblessed array reference containing the same entity references. Editing its membership cannot corrupt graph adjacency or this selection. Captured entity values remain read-only through public readers.
- [`where`](/en/perl/latest/reference/libtmux-windowselection-where/) (method), inherited from `LibTmux::Selection`: `where($criteria_or_filter)` eagerly returns a new selection of the same concrete class in scalar, list, or void context. Complete validation precedes evaluation, including on empty input. See [`"new" in LibTmux::Filter`](/en/perl/latest/reference/libtmux-filter-new/). Order and duplicate occurrences are preserved.
