Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

io.github.libtmux.TmuxEnvironment.TmuxEnvironment

Java
  • Python Unavailable
  • Ruby Unavailable
  • Lua Unavailable
  • TypeScript Unavailable
  • Rust Unavailable
  • Go Unavailable
  • Java
  • .NET Unavailable
  • C++ Unavailable
  • Swift Unavailable

View as Markdown

Module
io.github.libtmux.TmuxEnvironment
Package
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/TmuxEnvironment.java
class io.github.libtmux.TmuxEnvironment.TmuxEnvironment
classreadonly [source]
classreadonly [source]
class io.github.libtmux.TmuxEnvironment.TmuxEnvironment

What tmux tells a program running inside one of its panes.

tmux exports TMUX as <socket>,<server-pid>,<session> and TMUX_PANE as the pane's id. That is how a process discovers the server it is already inside, without being told where to look.

Reading is separated from the environment itself, so the parsing is testable without a process ever having to be started inside tmux: #of takes the variables, #current is the one-line wrapper that fetches them.

A class rather than a record for the reason ServerConfig gives — and because the pane is genuinely absent sometimes, which an Optional accessor says better than a nullable record component.

Examples

TmuxEnvironment here = TmuxEnvironment.current().orElseThrow();
try (Server server = Server.open(here.config())) {
Session mine = server.sessions().stream()
.filter(session -> session.id().equals(here.session()))
.findFirst()
.orElseThrow();
}

8 declared, 0 inherited

Members

  • current method Reads this process's own environment.
  • config method A config addressing this server, ready for Server#open .
  • of method Reads a set of environment variables.
  • pane method The pane this process is running in, absent when TMUX_PANE was not set.
  • serverPid method The process id of the tmux server, which is not the pane's process.
  • session method The session this process is running in.
  • socket method The socket the server is listening on.
  • toString method
Esc

Type to search.