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 latest

Session

tmux(1) Session [session_manual].

Source and package
Qualified name
libtmux.Session
Module
libtmux
Package
libtmux
Source
src/libtmux/session.py
Other languages
Perlclass ErlangPowerShellcmdlet Juliastruct Elixirstruct Haskell Common Lispclass RubyLuaTypeScriptRustGoJavaC#C++SwiftKotlinScalaOCamlF#module Clojurefunction
class libtmux.Session

Description#

Holds Window objects.

Examples#

>>> session
Session($1 ...)
>>> session.windows
[Window(@1 ...:..., Session($1 ...)]
>>> session.active_window
Window(@1 ...:..., Session($1 ...))
>>> session.active_pane
Pane(%1 Window(@1 ...:..., Session($1 ...)))

The session can be used as a context manager to ensure proper cleanup:

>>> with server.new_session() as session:
... window = session.new_window()
... # Do work with the window
... # Session will be killed automatically when exiting the context

References#

[session_manual]

tmux 3.7c manual, Description. "When tmux is started, it creates a new session with a single window and displays it on screen..." "A session is a single collection of pseudo terminals under the management of tmux. Each session has one or more windows linked to it." Create a session with new-session or attach a terminal with attach-session. Upstream source; OpenBSD tmux(1) manual.

Members44#

Parent objects1#

Collections and queries4#

  • windows property Windows contained by session.
  • panes property Panes contained by session's windows.
  • search_windows method Windows in this session, optionally filtered by tmux.
  • search_panes method Panes in this session, optionally filtered by tmux.

Common operations20#

Other members19#

Inherited members204 members#

Reached through libtmux.hooks.HooksMixin, libtmux.neo.Obj, libtmux.options.OptionsMixin, libtmux.common.EnvironmentMixin.

Guides#

Pages that discuss Session.

In other ports#

A tmux session

Equivalents of A tmux session in other languages
Language Equivalent
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
Java io.github.libtmux.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