# TmuxContext

- **Package:** libtmux-swift
- **Language:** Swift
- **Kind:** struct
- **Source:** https://github.com/libtmux/libtmux-swift/blob/254f8b2be7eb60cacc3ffcb3ea8e456784f582df/Sources/LibTmux/TmuxContext.swift#L12
- **Page:** https://libtmux.org/en/swift/latest/reference/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.
