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.

property libtmux latest

Window.linked_sessions

Every session this window is reachable from.

Source and package
Qualified name
libtmux.Window.linked_sessions
Module
libtmux
Declared in
Window
Package
libtmux
Source
src/libtmux/window.py
Other languages
Perl Erlang PowerShell Julia Elixir Haskell Common Lisp Ruby Lua TypeScriptRustGo Java C# C++ Swift Kotlin Scala OCaml F# Clojure
linked_sessions (self) → QueryList[Session]

Description#

Usually one, and then this is just Window.session in a list. link-window and grouped sessions (tmux new-session -t existing) make it more: the window is genuinely in each of them at once, and Window.session returns the session recorded on this Window instance.

Each session is listed once, however many indexes it links the window at, and they come back in the order tmux lists them. Fetching the holders takes two list commands total, independent of how many there are. If either listing fails, the result is empty.

Examples#

A window you just made belongs to the session you made it in:

>>> window = session.new_window(window_name="solo", attach=False)
>>> [s.session_name for s in window.linked_sessions] == [session.session_name]
True

Link it into a second session and it belongs to both:

>>> guest = server.new_session(session_name="guest")
>>> target = f"{guest.session_id}:"
>>> _ = server.cmd("link-window", "-d", "-s", window.window_id, "-t", target)
>>> sorted(s.session_name for s in window.linked_sessions) == sorted(
... [session.session_name, "guest"]
... )
True
Returns

QueryList of Session

tmux command#

The tmux commands behind linked_sessions.

tmux C API#

The C declarations in tmux that implement these commands.

Guides#

Pages that discuss linked_sessions.

In other ports#

Every session a window is linked into

Equivalents of Every session a window is linked into in other languages
Language Equivalent
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
TypeScript window.Window.linkedSessions
Rust window.Window.linked_sessions
Go tmux.Window.LinkedSessions
Java no equivalent on Window
C# LibTmux.Window.LinkedSessions
C++ Window::linked_sessions counts them rather than listing them
Swift no equivalent on Window
OCaml No direct public OCaml equivalent is recorded for this operation.
Perl Window::links returns WindowLink records; resolve each link’s session explicitly.

No equivalent is recorded in Ruby, Lua, PowerShell, Julia, Erlang, Elixir, Common Lisp, Clojure, Kotlin, Scala or F#.

Esc

Type to search.

Reference previewOpen reference