# API reference

Source: https://libtmux.org/en/kotlin/latest/reference/

> Types, methods, and functions in libtmux for Kotlin.

Kotlin API

Find a type or member

Browse the Kotlin types and operations for working with tmux. Start with the core objects below, or search for a type or member.

Server 2 types, 1 function or constant

[Server 49 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-server/)

Manages sessions, windows, and panes on a tmux server.

[LibTmuxDsl annotation](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-libtmuxdsl/)

Marks every builder below so an inner block cannot reach an outer block's receiver by accident: `split { directory = x }` inside `window { }` resolves to the innermost [`SplitBuilder` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-splitbuilder/), never to the [`WindowBuilder` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-windowbuilder/)it is nested in. Reaching the outer receiver on purpose still works, spelled explicitly (`this@window.directory = x`).

[withServer function](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withserver/)

Opens a [`Server` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-server/), runs [`block` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withserver/#io.github.libtmux.kotlin.withServer.parameter.block), and closes it — even if [`block` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withserver/#io.github.libtmux.kotlin.withServer.parameter.block)throws or is cancelled.

Session 2 types

[Session 26 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-session/)

A tmux session and its captured windows and properties.

[SessionBuilder 5 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-sessionbuilder/)

Configure a new session, its initial command, and its windows with [`Server.newSession` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-server-newsession/).

Window 2 types

[Window 38 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-window/)

A tmux window at a specific position in a session.

[WindowBuilder 5 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-windowbuilder/)

Configure a window and its pane splits inside a [`SessionBuilder` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-sessionbuilder/)block.

Pane 1 type

[Pane 53 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-pane/)

A tmux pane, with operations for input, output, and layout.

Client 1 type

[Client 15 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-client/)

An attached tmux client and its captured properties.

Hooks 1 type

[Hooks 10 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-hooks/)

Read and update hooks for the server, session, window, or pane that owns this handle.

Options — Functions 2 functions and constants

[orNull function](https://libtmux.org/en/kotlin/latest/reference/java-util-optionalint-ornull/)

java.util.OptionalInt

The value, or null when absent: an exit status, a captured server pid.

[orNull function](https://libtmux.org/en/kotlin/latest/reference/java-util-optionallong-ornull/)

java.util.OptionalLong

The value, or null when absent.

Keys and bindings 1 type

[Keys 9 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-keys/)

The server's key bindings, in one key table or across all of them.

Buffers 1 type

[Buffers 11 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-buffers/)

The tmux server's paste buffers.

Layout and geometry 1 type

[SplitBuilder 8 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-splitbuilder/)

Choose the position, size, and working directory of a new pane split.

Environment 1 type

[Environment 14 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-environment/)

Read and update environment variables used to start processes in tmux.

Commands 7 types, 1 function or constant

[Batch 9 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-batch/)

Several tmux commands collected to run together in one invocation.

[CommandChain 13 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-commandchain/)

A sequence of tmux commands where each one acts on what the last one made.

[Commands 6 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-commands/)

The commands this tmux knows, read without starting a server to answer.

[ExecutionPolicy 4 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-executionpolicy/)

Controls the dispatchers and concurrency limits for a [`Server` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-server/)'s suspending operations.

[MessageLog 6 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-messagelog/)

The server's own message log, newest last.

[Prompt 7 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-prompt/)

The server's command-prompt history.

[Shell 8 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-shell/)

A shell command run by tmux, and a tmux command chosen by a shell command's exit status.

[retryIfSafe function](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-retryifsafe/)

Retries [`block` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-retryifsafe/#io.github.libtmux.kotlin.retryIfSafe.parameter.block)up to [`times` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-retryifsafe/#io.github.libtmux.kotlin.retryIfSafe.parameter.times)more times after a [`DispatchException` ](https://libtmux.org/en/java/latest/reference/io-github-libtmux-exception-dispatchexception-dispatchexception/)whose [`DispatchException.safeToRetry` ](https://libtmux.org/en/java/latest/reference/io-github-libtmux-exception-dispatchexception-dispatchexception-safetoretry/)says the exact same request can be sent again.

Control mode 1 type, 3 functions and constants

[ControlClient 11 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-controlclient/)

A tmux client that stays attached and answers one command at a time.

[await function](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-channel-await/)

Waits for something to signal this channel.

[awaitReservingCapacity function](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-channel-awaitreservingcapacity/)

As [`await` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-channel-await/), while preserving process capacity for a call that signals it.

[withControl function](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withcontrol/)

As [`withServer` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withserver/), for a [`ControlClient` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-controlclient/)attached through [`server` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withcontrol/#io.github.libtmux.kotlin.withControl.parameter.server).

Queries 2 functions and constants

[filter function](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-iterable-filter/)

Selects the elements an expression matches.

[not function](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-query-filterexpr-not/)

Inverts an expression, so `!Pane_.active().isTrue()` says what it means.

Queries — Fields 5 types

[TextField 7 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-textfield/)

Kotlin-idiomatic wrappers over [`Fields` ](https://libtmux.org/en/java/latest/reference/io-github-libtmux-query-fields-fields/)' typed field handles, each holding the Java handle it wraps. A value class, so this costs nothing beyond the Java object it already holds — the same choice [`io.github.libtmux.kotlin.Server` ](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-server/)'s live handles reject, made here on purpose: a field handle carries exactly one property, which is what makes the boxing tradeoff free.

[NumberField 6 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-numberfield/)

Build numeric comparisons for a captured tmux field.

[FlagField 2 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-flagfield/)

Match a captured boolean field against true or false.

[ToManyField 3 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-tomanyfield/)

Match an object by the captured children related to it.

[ToOneField 1 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-toonefield/)

Match an object by one captured related object.

Constants and enums 1 type

[Options 13 members](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-options/)

Read and update options for the server, session, window, or pane that owns this handle.

## By module 8 modules

* java.util.OptionalInt 1

  * [or​Null](https://libtmux.org/en/kotlin/latest/reference/java-util-optionalint-ornull/)

* java.util.OptionalLong 1

  * [or​Null](https://libtmux.org/en/kotlin/latest/reference/java-util-optionallong-ornull/)

* io.github.libtmux.Channel 2

  * [await](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-channel-await/)
  * [await​Reserving​Capacity](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-channel-awaitreservingcapacity/)

* io.github.libtmux.kotlin 25

  * [Batch](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-batch/)
  * [Buffers](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-buffers/)
  * [Client](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-client/)
  * [Command​Chain](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-commandchain/)
  * [Commands](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-commands/)
  * [Control​Client](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-controlclient/)
  * [Environment](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-environment/)
  * [Execution​Policy](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-executionpolicy/)
  * [Hooks](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-hooks/)
  * [Keys](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-keys/)
  * [Message​Log](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-messagelog/)
  * [Options](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-options/)
  * [Pane](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-pane/)
  * [Prompt](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-prompt/)
  * [Server](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-server/)
  * [Session](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-session/)
  * [Session​Builder](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-sessionbuilder/)
  * [Shell](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-shell/)
  * [Split​Builder](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-splitbuilder/)
  * [Window](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-window/)
  * [Window​Builder](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-windowbuilder/)
  * [Lib​Tmux​Dsl](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-libtmuxdsl/)
  * [retry​If​Safe](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-retryifsafe/)
  * [with​Control](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withcontrol/)
  * [with​Server](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-withserver/)

* io.github.libtmux.kotlin.Iterable 1

  * [filter](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-iterable-filter/)

* io.github.libtmux.kotlin.query 5

  * [Flag​Field](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-flagfield/)
  * [Number​Field](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-numberfield/)
  * [Text​Field](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-textfield/)
  * [To​Many​Field](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-tomanyfield/)
  * [To​One​Field](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-query-toonefield/)

* io.github.libtmux.query.FilterExpr 1

  * [not](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-query-filterexpr-not/)

* Types 1

  * [Lib​Tmux​Dsl](https://libtmux.org/en/kotlin/latest/reference/io-github-libtmux-kotlin-libtmuxdsl/)
