# LibTmux.snapshot

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Julia
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/acquisition.jl#L201
- **Page:** https://libtmux.org/en/julia/latest/reference/libtmux-snapshot-1gv6/

```
snapshot(connection::LibTmux.ControlConnection; timeout, cancel)

snapshot(server::LibTmux.Server; timeout, cancel)
```

## Methods

### `snapshot(connection::LibTmux.ControlConnection; timeout, cancel)`

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/control_io.jl#L238).

Acquire the captured graph over the existing terminal control connection. Two observations must agree on topology, with at most one retry within the deadline. Field values are captured observations, not an atomic transaction. The connection's two attached clients are included in client/attachment counts. Local collection and coverage semantics match `snapshot(server)`.

```julia
snapshot(connection::ControlConnection; timeout=5.0, cancel=nothing)
```

### `snapshot(server::LibTmux.Server; timeout, cancel)`

[Source](https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/acquisition.jl#L218).

Capture sessions, physical windows/panes, contextual links and attached clients. Transient unattached command clients are outside tmux's `list-clients` source. Accessors and filtering use only this captured graph. New acquisitions never refresh earlier values. Retaining a selection may retain its whole snapshot.

```julia
snapshot(server; timeout=5.0, cancel=nothing)
```



Two observations must agree on topology and observed daemon identity. A topology race retries once within one monotonic deadline. This is a stable local observation after acquisition, not a transaction or reservation. The `acquired` interval contains process-relative monotonic seconds.

Subprocess generation (PID and start time) and client incarnation (PID and creation time) are best-effort observations. They do not provide strict protection against identity reuse or the check/use race during later actions.

## Parameters

- `connection` (`LibTmux.ControlConnection`) (for `snapshot(connection, timeout, cancel)`)
- `timeout` (`Real`)
  Default: `5.0`.
- `cancel` (`Union{Nothing, CancellationToken}`)
  Default: `nothing`.
- `server` (`LibTmux.Server`) (for `snapshot(server, timeout, cancel)`)

## In other ports

### Capture the tmux hierarchy

- PowerShell: [`LibTmux\Get-TmuxSnapshot`](/en/powershell/latest/reference/libtmux-get-tmuxsnapshot/) (cmdlet). Acquires a replacement `LibTmux.Server` to [`-Depth`](/en/powershell/latest/reference/libtmux-get-tmuxsnapshot/#LibTmux%5CGet-TmuxSnapshot.parameter.Depth) (panes by default). Acquisition is not atomic; retained handles do not refresh.
- Ruby: [`LibTmux::Server#snapshot`](/en/ruby/latest/reference/libtmux-server-snapshot/) (method)
- Lua: [`libtmux.Server:snapshot`](/en/lua/latest/reference/libtmux-server-snapshot/) (method)
- TypeScript: [`server.Server.snapshot`](/en/ts/latest/reference/server-server-snapshot/) (method)
- Go: [`tmux.Server.Snapshot`](/en/go/latest/reference/tmux-server-snapshot/) (method)
- Java: [`io.github.libtmux.Server.Server.snapshot`](/en/java/latest/reference/io-github-libtmux-server-server-snapshot/) (method)
- C#: [`LibTmux.Server.CaptureSnapshotAsync`](/en/csharp/latest/reference/libtmux-server-capturesnapshotasync/) (method)
- Swift: [`Server.snapshot()`](/en/swift/latest/reference/server-snapshot()/) (method)
- Kotlin: [`io.github.libtmux.kotlin.Server.snapshot`](/en/kotlin/latest/reference/io-github-libtmux-kotlin-server-snapshot/) (method)
- Scala: [`io.github.libtmux.scaladsl.Server.snapshot`](/en/scala/latest/reference/io-github-libtmux-scaladsl-server-snapshot/) (method)
- F#: [`LibTmux.FSharp.Server.capture`](/en/fsharp/latest/reference/libtmux-fsharp-server-capture/) (function). Acquires a replacement shared .NET `LibTmux.Server` to the requested depth. Acquisition is not atomic; retained handles do not refresh.
