# LibTmux.set_environment

- **Module:** LibTmux
- **Package:** LibTmux
- **Language:** Julia
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-julia/blob/f3da513be1225d36d5854cd8db5972c01857578e/src/configuration.jl#L361
- **Page:** https://libtmux.org/en/julia/latest/reference/libtmux-set_environment/

```
set_environment(
    connection::LibTmux.ControlConnection,
    scope,
    name::AbstractString,
    value::AbstractString;
    hidden,
    kwargs...
)

set_environment(
    server::LibTmux.Server,
    scope,
    name::AbstractString,
    value::AbstractString;
    hidden,
    kwargs...
)
```

## Methods

### `set_environment` (overload 1)

```julia
set_environment(
    connection::LibTmux.ControlConnection,
    scope,
    name::AbstractString,
    value::AbstractString;
    hidden,
    kwargs...
)
```

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

Set a literal environment value through the existing control connection and return its `ControlResult`. Scope is `:global` or an exact `SessionRef`. Empty values, format punctuation and line breaks remain data. The daemon generation stays pinned; cancellation after submission does not undo the write. Timeout and cancellation follow the control creation methods.

```julia
set_environment(connection::ControlConnection, scope, name, value; hidden=false, kwargs...)
```

### `set_environment` (overload 2)

```julia
set_environment(
    server::LibTmux.Server,
    scope,
    name::AbstractString,
    value::AbstractString;
    hidden,
    kwargs...
)
```

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

Set a literal environment value at `:global` or `SessionRef`; return `CommandResult`.

## Parameters

- `connection` (`LibTmux.ControlConnection`) (for `set_environment(connection, scope, name, value, hidden, kwargs)`)
- `scope` (`Any`)
- `name` (`AbstractString`)
- `value` (`AbstractString`)
- `hidden` (`Bool`)
  Default: `false`.
- `kwargs`
- `server` (`LibTmux.Server`) (for `set_environment(server, scope, name, value, hidden, kwargs)`)
