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.

class libtmux-java latest

Session

One tmux session, as one capture saw it.

Source and package
Qualified name
io.github.libtmux.Session
Package
io.github.libtmux
Distribution
io.github.libtmux:libtmux
Source
libtmux/src/main/java/io/github/libtmux/Session.java
Other languages
Perlclass ErlangPowerShellcmdlet Juliastruct Elixirstruct Haskell Common Lispclass PythonRubyLuaTypeScriptRustGoC#C++SwiftKotlinScalaOCamlF#module Clojurefunction
class io.github.libtmux.Session

Description#

Identity is the server and the session id. A name is state: a user can rename a session at any time, and a handle whose equality included the name would stop matching itself the moment they did.

#windows() reads the capture this handle came from and issues no command. To see newer state, take a new capture.

A method named for a captured field returns what #info() holds and does no I/O; #refresh() reads again. Every other method asks tmux now.

What is on here

The methods fall into a few groups:

Reading the capture
Read what this capture stored about the session, and the Server it lives on, with no call to tmux. The id is stable, the name is state a user may change at any time, and a rename or an attach after the capture does not show in it.
Windows and panes
List the session's windows in tmux's order, or ask for the window tmux had active and the active pane of that window, each as an Optional. These are pure reads of the capture and issue no command. Make a window the active one, step to the next or previous with wrap-around, or go back to the one that was active before, which throws when nothing else has been active yet.
Changing the session
Create a window by name, from a callback that fills in a builder, or from a WindowSpec that can be reused across sessions, and get back the window made, from a fresh capture; a spec that reuses an existing window gets the one with that name, found by a lookup. Renaming returns a replacement capture, because this handle keeps its original state; setting the history limit sets the scrollback retained by panes created in this session. Detaching clients leaves the session running, and killing it takes every window with it.
Options, environment, and hooks
These reach what is set on this session alone: its own options, its own hooks, and its own environment, which a process started in it is given on top of the server's. The Server holds the global ones, which a session inherits.
Formats and refreshing
Expand a tmux format in this session's context, or take a new capture to see the session as it is now. Refreshing leaves this handle unchanged and returns the new one, and throws TargetGoneException if the session is gone from a server that still answers.

Members27#

Parent objects1#

  • server method The server this session lives on.

Collections and queries1#

  • windows method This session's windows, in tmux's order. A pure read of the capture.

Common operations16#

  • newWindow method Creates a window in this session and returns that exact window.
  • kill method Ends this session. Every window in it goes with it.
  • rename method Renames this session and returns its replacement capture.
  • hooks method This session's own hooks.
  • id method The session's stable id.
  • name method The session name, which a user may change at any time.
  • attached method Whether a client was attached when this was captured.
  • options method This session's own options.
  • detachClients method Detaches every client attached to this session, leaving the session running.
  • activeWindow method The window tmux had active in this session. A pure read of the capture.
  • activePane method The active pane of the active window. A pure read of the capture.
  • refresh method Takes a new capture and returns this session as it is now.
  • nextWindow method Moves to the next window in this session, wrapping at the end.
  • previousWindow method Moves to the previous window in this session, wrapping at the start.
  • lastWindow method Returns to the window that was active before this one.
  • selectWindow method Makes a window of this session the active one.

Other members9#

  • environment method This session's own environment, which a process started in it is given on top of the server's.
  • equals method
  • expand method Expands a tmux format in this session's context, and answers with what it came to.
  • hashCode method
  • info method The fields this capture stored. A later rename is not visible here.
  • Session method
  • setHistoryLimit method Sets the scrollback retained by panes created in this session.
  • snapshot method
  • toString method

Guides#

Pages that discuss Session.

Topics

In other ports#

A tmux session

Equivalents of A tmux session in other languages
Language Equivalent
Python libtmux.Session
Ruby LibTmux::Session
Lua libtmux.Session
PowerShell LibTmux\Get-TmuxSession This cmdlet reads and returns shared .NET LibTmux.Session objects. Child windows and panes require further acquisition.
Julia LibTmux.SessionSnapshot SessionSnapshot holds captured session data. Actions use its SessionRef, a typed identity bound to an observed daemon generation.
Erlang #tmux_model:session{}
Elixir LibTmux.Session Session is an immutable observation. Fields not captured read as :unloaded.
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
Common Lisp libtmux:session session is an immutable captured entity. The same name also has a relation accessor with a distinct public identity.
TypeScript session.Session
Rust session.Session
Go tmux.Session
Clojure libtmux.core/sessions! Acquires a vector of captured session maps. The session value is a map, not a wrapper class.
Kotlin io.github.libtmux.kotlin.Session
Scala io.github.libtmux.scaladsl.Session
C# LibTmux.Session
F# LibTmux.FSharp.Session This F# module builds deferred child queries from a shared .NET LibTmux.Session and its server association. Query.list acquires their results from tmux.
C++ libtmux::Session
Swift Session
OCaml Libtmux.Session.t
Perl LibTmux::Session A captured read-only entity; explicit Server operations accept its stable identity.
Esc

Type to search.

Reference previewOpen reference