# TmuxContext

- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-swift/blob/f02a4668570e1cc5198c941413750e021f42c214/Sources/LibTmux/TmuxContext.swift#L11
- **Page:** https://libtmux.org/reference/swift/tmuxcontext/

Where the tmux this process is running inside can be found.

tmux sets `$TMUX` in every process it starts, holding the socket, the
server's pid, and the session — which is how a program launched from a pane
can find its way back to the server that launched it without being told.

The session arrives as a bare number where ``Session/id`` carries tmux's
`$` sigil, so it is normalised here. Comparing the two spellings directly is
a mismatch that looks like a missing session.

## Members

- `!=(_:_:)` (function) — Returns a Boolean value indicating whether two values are not equal.
- `socketPath` (property) — The socket the surrounding server listens on, which is what addressing it again needs.
- `serverProcessID` (property) — The server process, which is the one thing here that distinguishes two servers that reused a socket path.
- `sessionID` (property) — The session, normalised to the spelling ``Session/id`` uses.
- `init(socketPath:serverProcessID:sessionID:)` (method)
- `init(parsing:)` (method) — Reads the value tmux puts in `$TMUX`.
- `current(environment:)` (method) — The context of the tmux this process is running inside, or `nil` when it is not running inside one.
- `server(tmuxExecutable:)` (method) — A server addressed at this context's socket.
- `init(from:)` (method) — Creates a new instance by decoding from the given decoder.
