# LibTmux.Server.FromEnvironment

- **Module:** LibTmux.Server
- **Package:** LibTmux
- **Language:** .NET
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-dotnet/blob/6656a563ec9e07ab52e0c3ac96f7704fc94cc0c0/src/LibTmux/Server.FromEnvironment.cs#L21
- **Page:** https://libtmux.org/reference/dotnet/libtmux-server-fromenvironment/

```
LibTmux.Server.FromEnvironment(environment: IReadOnlyDictionary<string, string>?) -> Server
```

Returns the server whose pane this process was spawned in.

Only the socket path is used. The pid and session id in <c>TMUX</c> are
frozen at pane spawn, and the session id goes stale as soon as the
pane's window moves between sessions. Costs no tmux subprocess.

## Parameters

- `environment` (IReadOnlyDictionary<string, string>?) — The environment, or null for the process.

## Returns

An unmaterialized handle for the exported socket.

## Raises

- `TmuxObjectNotFoundException` — The environment does not name a tmux server.
