# session.Session.selectWindow

- **Module:** session
- **Package:** libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/073b9d7dedad900bff6f5ec0ea47794e40225870/packages/libtmux/src/session.ts#L437
- **Page:** https://libtmux.org/en/ts/latest/reference/session-session-selectwindow/

```
selectWindow(
  target: Window | WindowTarget,
): Promise<void>
```

Select the last, next, or previous window, or one named by target.

## Examples

```ts
await session.selectWindow("next");
```

## Parameters

- `target` (`Window | WindowTarget`)

## tmux command

The tmux commands behind `selectWindow`.

- [`last-window`](/en/tmux/latest/manual/last-window/) (the target is "last")
- [`next-window`](/en/tmux/latest/manual/next-window/) (the target is "next")
- [`previous-window`](/en/tmux/latest/manual/previous-window/) (the target is "previous")
- [`select-window`](/en/tmux/latest/manual/select-window/) (the target is not last, next or previous)

## tmux C API

The C declarations in tmux that implement these commands.

- [`cmd_last_window_entry`](/en/tmux/latest/reference/c-variable-cmd_last_window_entry/) (attribute)
- [`cmd_select_window_exec`](/en/tmux/latest/reference/c-function-cmd-select-window-c-cmd_select_window_exec/) (function)
- [`cmd_next_window_entry`](/en/tmux/latest/reference/c-variable-cmd_next_window_entry/) (attribute)
- [`cmd_previous_window_entry`](/en/tmux/latest/reference/c-variable-cmd_previous_window_entry/) (attribute)
- [`cmd_select_window_entry`](/en/tmux/latest/reference/c-variable-cmd_select_window_entry/) (attribute)

## In other ports

Make a window of a session active

| Language | Equivalent |
| --- | --- |
| Python | [`libtmux.Session.select_window`](/en/py/latest/reference/libtmux-session-select_window/) (method) |
| Rust | no equivalent on `Session` |
| Go | [`tmux.Session.SelectWindow`](/en/go/latest/reference/tmux-session-selectwindow/) (method) |
| Java | [`io.github.libtmux.Session.selectWindow`](/en/java/latest/reference/io-github-libtmux-session-session-selectwindow/) (method) |
| C# | [`LibTmux.Session.SelectWindowAsync`](/en/csharp/latest/reference/libtmux-session-selectwindowasync/) (method) |
| C++ | no equivalent on `Session` |
| Swift | no equivalent on `Session` |

No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Elixir, Kotlin, Scala or F#.
