# Libtmux_unix.Client.link_window

- **Module:** Libtmux_unix
- **Package:** libtmux-unix
- **Language:** OCaml
- **Kind:** function
- **Source:** https://github.com/libtmux/libtmux-ocaml/blob/205dfda49742592b479247049d186956e4a4cfe9/unix/libtmux_unix.mli#L624
- **Public owner:** Libtmux_unix
- **Page:** https://libtmux.org/en/ocaml/latest/reference/libtmux_unix-client-link_window/

```
val link_window :
  ?cancel:Cancellation.t ->
  t ->
  Libtmux.Window.target ->
  session:Libtmux.Session.target ->
  index:int -> (unit, Libtmux.Error.t) result
```

Add a session-specific link to the global window at `index`, rejecting an occupied index. The source window and its panes stay shared.

## Parameters

- `cancel?` (`Cancellation.t`)
- `arg1` (`t`)
- `arg2` (`Libtmux.Window.target`)
- `session` (`Libtmux.Session.target`)
- `index` (`int`)

## tmux command

The tmux commands behind `link_window`.

- [`link-window`](/en/tmux/latest/manual/link-window/)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_link_window_entry`](/en/tmux/latest/reference/c-variable-cmd_link_window_entry/) (attribute)
- [`cmd_move_window_exec`](/en/tmux/latest/reference/c-function-cmd-move-window-c-cmd_move_window_exec/) (function)

## In other ports

Link a window into another session

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Window.link`](/en/py/latest/reference/libtmux-window-link/) (method) |
| Ruby | [`LibTmux::Session#link_window`](/en/ruby/latest/reference/libtmux-session-link_window/) (method) |
| Lua | [`libtmux.WindowLink:link`](/en/lua/latest/reference/libtmux-windowlink-link/) (method) |
| Erlang | [`tmux_window_link:link/3`](/en/erlang/latest/reference/tmux_window_link-link-3/) (function) |
| Haskell | No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing. |
| TypeScript | [`window.Window.link`](/en/ts/latest/reference/window-window-link/) (method) |
| Rust | [`window.Window.link_to`](/en/rs/latest/reference/window-window-link_to/) (method) |
| Go | [`tmux.Window.Link`](/en/go/latest/reference/tmux-window-link/) (method) |
| Java | [`io.github.libtmux.Window.linkTo`](/en/java/latest/reference/io-github-libtmux-window-window-linkto/) (method) |
| C# | [`LibTmux.Window.LinkAsync`](/en/csharp/latest/reference/libtmux-window-linkasync/) (method) |
| C++ | [`libtmux::Window::link_to`](/en/cxx/latest/reference/libtmux-window-link_to/) (method) |
| Swift | [`Server.link(_:into:)`](/en/swift/latest/reference/server-link(_-into-)/) (method) |
| Perl | [`LibTmux::Server::link_window`](/en/perl/latest/reference/libtmux-server-link_window/) (method). Explicit Server operation. Captured entities remain local observations; use a new snapshot to observe changes. |

No equivalent is recorded in PowerShell, Julia, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.
