# LibTmux.link_window

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

```
link_window(
    connection::LibTmux.ControlConnection,
    source::LibTmux.WindowLinkRef,
    destination::LibTmux.SessionRef;
    index,
    replace,
    select,
    kwargs...
)

link_window(
    server::LibTmux.Server,
    source::LibTmux.WindowLinkRef,
    destination::LibTmux.SessionRef;
    index,
    replace,
    select,
    kwargs...
)
```

## Methods

### `link_window` (overload 1)

```julia
link_window(
    connection::LibTmux.ControlConnection,
    source::LibTmux.WindowLinkRef,
    destination::LibTmux.SessionRef;
    index,
    replace,
    select,
    kwargs...
)
```

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

Execute `link-window` with explicit source and destination session/index slots. Replacement and selection follow the subprocess method. The daemon generation is pinned, but a link's index/window membership is checked before submission and can change concurrently. This does not reserve a topology transaction. Repeated links to one physical window retain their separate slot semantics. Return `ControlResult`; no fallback or replay occurs.

```julia
link_window(connection::ControlConnection, source::WindowLinkRef, destination::SessionRef; index, kwargs...)
```

### `link_window` (overload 2)

```julia
link_window(
    server::LibTmux.Server,
    source::LibTmux.WindowLinkRef,
    destination::LibTmux.SessionRef;
    index,
    replace,
    select,
    kwargs...
)
```

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

Link the source window at an explicit destination index. Existing links remain. An occupied destination errors unless `replace=true`, which removes that link and may destroy its window. `select=true` selects the new destination link. Return the command result; generation and link checks are best effort.

```julia
link_window(server, source::WindowLinkRef, destination::SessionRef;
            index, replace=false, select=false, kwargs...)
```

## Parameters

- `connection` (`LibTmux.ControlConnection`) (for `link_window(connection, source, destination, index, replace, select, kwargs)`)
- `source` (`LibTmux.WindowLinkRef`)
- `destination` (`LibTmux.SessionRef`)
- `index` (`Integer`)
- `replace` (`Bool`)
  Default: `false`.
- `select` (`Bool`)
  Default: `false`.
- `kwargs`
- `server` (`LibTmux.Server`) (for `link_window(server, source, destination, index, replace, select, kwargs)`)
