# LibTmux::Snapshot

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Perl
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-perl/blob/352715a4fa66a96eed7763b90daaa536aa2f121d/packages/core/lib/LibTmux/Snapshot.pm#L1
- **Page:** https://libtmux.org/en/perl/latest/reference/libtmux-snapshot/

```
package LibTmux::Snapshot;
```

Captured graph with explicit completeness


## EXECUTION

All methods in this module operate on local captured data and perform no tmux I/O. Ordering is deterministic; public query methods do not mutate membership. Typed validation/evaluation errors propagate. See [`"snapshot" in LibTmux::Server`](/en/perl/latest/reference/libtmux-server-snapshot/) for explicit acquisition and [`LibTmux::X`](/en/perl/latest/reference/libtmux-x/) for machine-readable failures.



## Members

### Collections and queries

- [`sessions`](/en/perl/latest/reference/libtmux-snapshot-sessions/) (method): Return a fresh [`LibTmux::SessionSelection`](/en/perl/latest/reference/libtmux-sessionselection/) in captured order. Empty loaded collections yield empty selections; unloaded collections throw.
- [`windows`](/en/perl/latest/reference/libtmux-snapshot-windows/) (method): Return a fresh [`LibTmux::WindowSelection`](/en/perl/latest/reference/libtmux-windowselection/) containing each physical window identity once. Context lives in [`"window_links"`](/en/perl/latest/reference/libtmux-snapshot-window_links/).
- [`panes`](/en/perl/latest/reference/libtmux-snapshot-panes/) (method): Return a fresh [`LibTmux::PaneSelection`](/en/perl/latest/reference/libtmux-paneselection/) containing each physical pane identity once. Membership edits cannot change the graph store.
- [`clients`](/en/perl/latest/reference/libtmux-snapshot-clients/) (method): Return a fresh [`LibTmux::ClientSelection`](/en/perl/latest/reference/libtmux-clientselection/) in captured order. A loaded empty client set is valid.

### Common operations

- [`session_by_id`](/en/perl/latest/reference/libtmux-snapshot-session_by_id/) (method): `session_by_id('$1')` returns a [`LibTmux::Session`](/en/perl/latest/reference/libtmux-session/) or undef. Single quotes preserve the dollar-prefixed ID instead of interpolating a regex capture.
- [`window_by_id`](/en/perl/latest/reference/libtmux-snapshot-window_by_id/) (method): `window_by_id('@3')` returns one physical [`LibTmux::Window`](/en/perl/latest/reference/libtmux-window/) or undef, independent of session link context.
- [`pane_by_id`](/en/perl/latest/reference/libtmux-snapshot-pane_by_id/) (method): `pane_by_id('%3')` returns a [`LibTmux::Pane`](/en/perl/latest/reference/libtmux-pane/) or undef. The returned handle retains the captured graph after this wrapper goes out of scope.

### Other members

- [`complete`](/en/perl/latest/reference/libtmux-snapshot-complete/) (method): Return the capture completeness Boolean. The strict live acquisition path fails on incomplete topology; it does not synthesize empty relations.
- [`from_records`](/en/perl/latest/reference/libtmux-snapshot-from_records/) (method): `from_records(server_id => ..., generation => ..., sessions => [...], windows => [...], window_links => [...], panes => [...], clients => [...])` constructs a detached graph. Scalar records and relation IDs are copied. Omitted fields/collections remain unloaded; null is explicit. Invalid identities or inconsistent complete topology throw typed acquisition errors.
- [`generation`](/en/perl/latest/reference/libtmux-snapshot-generation/) (method): Return the captured daemon generation. [`LibTmux::Server`](/en/perl/latest/reference/libtmux-server/) checks it before mutations through captured handles; retained snapshots never silently refresh.
- [`metadata`](/en/perl/latest/reference/libtmux-snapshot-metadata/) (method): Return a fresh metadata hash with capture start/end, daemon version, and PID where acquired. Several commands observe an interval; the snapshot is not an atomic tmux transaction.
- [`server_id`](/en/perl/latest/reference/libtmux-snapshot-server_id/) (method): Return the captured server scope. Entity IDs are meaningful only within this scope and [`"generation"`](/en/perl/latest/reference/libtmux-snapshot-generation/).
- [`to_records`](/en/perl/latest/reference/libtmux-snapshot-to_records/) (method): Return independent scalar records and adjacency IDs for detached use. No handles or live transport are serialized.
- [`window_links`](/en/perl/latest/reference/libtmux-snapshot-window_links/) (method): Return a fresh [`LibTmux::WindowLinkSelection`](/en/perl/latest/reference/libtmux-windowlinkselection/) retaining every session/index association, including repeated links of one physical window.
