Core Library0.xAPI Reference

Choose documentation 3

latest

Current version

latest
English

Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.

Swift API

method libtmux-swift latest

Server.init(tmuxExecutable:configurationFile:environment:)

A server on the socket the environment names, else on the one tmux picks.

Source and package
Qualified name
Server.init(tmuxExecutable:configurationFile:environment:)
Declared in
Server
Package
libtmux-swift
Source
Sources/LibTmux/Server.swift

Description#

LIBTMUX_SOCKET_PATH names a socket path, passed to tmux as -S. Otherwise LIBTMUX_SOCKET names a socket name, passed as -L. With neither set the server's endpoint is Endpoint.tmuxChoice: tmux is passed no socket and chooses the server itself, the one in TMUX inside tmux and the default socket in TMUX_TMPDIR elsewhere. The path wins when both variables are set, as it does for the Python library. A variable that is empty or only whitespace counts as unset, each one on its own, so a blank path leaves a set name in force; any other value is used as written.

Name a socket with init(socketPath:tmuxExecutable:configurationFile:) or init(socketName:tmuxExecutable:configurationFile:) when the answer must not depend on the environment; those leave both variables unread. Only the two variables are read from environment. Every tmux process the server starts inherits the process's own environment, TMUX included.

  • Parameter environment: where to read the two variables from.
  • Throws: TmuxError.invalidEndpoint(_:) for a socket path that is too long. The error names the length and never the value.

Examples#

let server = try Server()
let sessions = try await server.sessions()
Esc

Type to search.

Reference previewOpen reference