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.

struct libtmux-go latest

Window

Window is one materialized (session, index, window) winlink record. It is normally returned by Server.Snapshot, Server.Window, or Window.Refresh. A zero Window is not a usable tmux target.

Source and package
Qualified name
tmux.Window
Package
tmux
Distribution
github.com/libtmux/libtmux-go/tmux
Source
tmux/model.go
Other languages
Perlclass Erlangstruct PowerShellcmdlet Juliastruct Elixirstruct Haskell Common Lispclass PythonRubyLuaTypeScriptRustJavaC#C++SwiftKotlinScalaOCamltypealias F#module Clojurefunction
struct tmux.Window

Members158#

Parent objects3#

  • Session method Session returns this view's parent record when it remains in the same snapshot. It never queries tmux.
  • ResolveSession method ResolveSession snapshots live tmux state and returns this exact winlink's parent session. It returns SnapshotLookupError cardinality errors.
  • Server method Server returns the configured handle that produced the window.

Collections and queries2#

  • Panes method Panes returns newly allocated shallow copies of panes for this exact winlink, and reports whether the receiver carries relations at all.
  • SearchPanes method SearchPanes returns this window's pane views selected by tmux's live -f expression. A nil filter omits -f and a nonnil empty filter sends an explicit expression. Stable session and window identities limit the projection.

Common operations41#

  • SelectLayout method SelectLayout applies one layout operation to the receiver's exact winlink. It changes pane geometry without selecting the window or promising client focus. The materialized receiver is not refreshed, so callers that need current pane geometry must obtain a new snapshot or refresh related models. A transport or context error can be delivery-ambiguous; the void result cannot carry partial state and no rollback is attempted.
  • Kill method Kill destroys the stable window selected by the receiver's WindowID, removes all of its winlinks, and destroys its panes. Affected sessions preserve their current selection unless this window was current, in which case they select another. A session left without windows is destroyed; Session.Kill describes how tmux handles its clients. The receiver is not refreshed. Only stderr makes a completed command a CommandError; nonzero exits without stderr are ignored.
  • Rename method Rename changes the stable window through the receiver's exact winlink and returns a canonical freshly materialized Window. The returned winlink may therefore use another session when the WindowID is linked. If the command succeeds but refresh fails, Rename returns the receiver with that error. A transport or context error can be delivery-ambiguous; no rollback is attempted.
  • Link method Link adds the stable window to TargetSession as another winlink, targeting the source through the receiver's exact session. Unless Detach is set, tmux makes the new link current in the target session; this is not a global client-focus guarantee. Link does not refresh or mutate the materialized source Window. A transport or context error can be delivery-ambiguous; the void result cannot carry the new winlink identity and no rollback is attempted.
  • Unlink method Unlink removes the receiver's exact session winlink without refreshing the materialized receiver. Without KillIfLast, tmux rejects removal of a stable window's only link; with it, that window is destroyed. A transport or context error can be delivery-ambiguous; the void result cannot carry partial identity and no rollback is attempted.
  • Select method Select makes the receiver's exact winlink current in its session. It does not promise focus for clients attached to other sessions. Select returns a canonical freshly materialized Window, which may use another linked session for the same WindowID. If the command succeeds but refresh fails, it returns the receiver with that error. A transport or context error can be delivery-ambiguous; no rollback is attempted.
  • ID method ID returns the underlying stable tmux window identity.
  • Name method Name returns tmux #{window_name} as string from this Window's materialized window-scoped fields.
  • Move method Move removes the receiver's exact winlink and places it in TargetSession, or renumbers the selected session when Renumber is set. Unless NoSelect is set, tmux makes the moved winlink current in the destination session; this is not a global client-focus guarantee. The stable WindowID does not by itself identify either linked view.
  • SplitPane method SplitPane creates a tiled pane in the receiver's exact winlink. Attach makes the new pane active in that session and winlink; it is not a global client-focus guarantee. The returned Pane is freshly materialized in the receiver SessionID and WindowID rather than by canonical ID-only refresh. Pane.Split is the equivalent operation relative to an existing pane rather than its window.
  • Height method Height returns tmux #{window_height} as int from this Window's materialized window-scoped fields.
  • Width method Width returns tmux #{window_width} as int from this Window's materialized window-scoped fields.
  • Options method Options returns a freshly decoded, caller-owned view of known options at this exact window target, including inherited values. The receiver's exact linked session context controls tmux format evaluation. A read failure is returned rather than answered with zero values. Each returned accessor names the setter that writes it, so WindowOptionValues.MainPaneWidth pairs with Window.SetMainPaneWidth.
  • Index method Index returns this window's index in its linked session. It returns -1 for a partial Window whose exact winlink has not been materialized.
  • Resize method Resize changes the stable window's size through the receiver's exact winlink. It does not select the window or promise any client focus. Resize returns a canonical freshly materialized Window, which may use another linked session for the same WindowID. If the command succeeds but refresh fails, it returns the receiver with that error; other command failures return a zero Window. A transport or context error can be delivery-ambiguous and no rollback is attempted.
  • Rotate method Rotate rotates pane positions in the receiver's exact winlink without selecting the window or promising client focus. It returns a freshly materialized exact Window preserving the receiver SessionID, rather than a canonical ID-only view. If the command succeeds but refresh fails, Rotate returns the receiver with that error; earlier failures return zero.
  • SetOption method SetOption stores a window option at this exact window target without refreshing existing models. Completed failures are secret-safe option errors; cancellation does not prove tmux did not accept the mutation.
  • UnsetOption method UnsetOption unsets a window option at this exact window target, or its pane copies with UnsetPanes, without refreshing models. Cancellation does not prove the unset was not accepted.
  • Hooks method Hooks returns a freshly decoded, caller-owned view of known hooks at this exact window target, including inherited values. The receiver's exact linked session context controls tmux format evaluation. A read failure is returned rather than answered with zero values.
  • Active method Active returns tmux #{window_active} as bool from this Window's materialized window-scoped fields.
  • Layout method Layout returns tmux #{window_layout} as string from this Window's materialized window-scoped fields.
  • Respawn method Respawn restarts the stable window process through the receiver's exact winlink. It does not select the window or promise any client focus. Respawn returns a canonical freshly materialized Window, which may use another linked session for the same WindowID. If the command succeeds but refresh fails, it returns the receiver with that error; earlier failures return zero. Completed stderr produces a redacted CommandError; nonzero exits without stderr are followed by refresh.
  • Swap method Swap exchanges the receiver and Target exact winlinks. Their stable WindowIDs move to the opposite session-and-index views; a WindowID alone does not identify either endpoint. Unless Detach is set, tmux may change the affected sessions' current-window selection; this is not a global client-focus guarantee.
  • ActivePane method ActivePane returns the first active pane in this materialized winlink view. It never queries tmux; use Window.ResolveActivePane for live state.
  • RawOption method RawOption returns one exact window option value at this exact window target. A successful string is caller-owned; the receiver's exact linked session context controls tmux format evaluation, and a completed failure is returned.
  • NextLayout method NextLayout applies the next preset layout to the receiver's exact winlink. It changes pane geometry without selecting or refreshing the window. A transport or context error can be delivery-ambiguous; the void result cannot carry partial state and no rollback is attempted.
  • SetHook method SetHook stores a window hook at this exact window target without refreshing models. Completed failures are secret-safe option errors; cancellation does not prove tmux did not accept the mutation.
  • UnsetHook method UnsetHook removes every matching window hook index at this exact window target without refreshing models. Completed failures are secret-safe option errors; cancellation does not prove the unset was accepted.
  • Refresh method Refresh performs a canonical live lookup for the window's stable ID and returns a new record without mutating the receiver. It does not preserve a linked-session view; use Window.ResolveSession for exact relationships.
  • PreviousLayout method PreviousLayout applies the previous preset layout to the receiver's exact winlink. It changes pane geometry without selecting or refreshing the window. A transport or context error can be delivery-ambiguous; the void result cannot carry partial state and no rollback is attempted.
  • LastPane method LastPane targets the receiver's exact winlink. Its zero request makes the previously active pane active without selecting the window in its session. With an Input mode, tmux changes the previous pane's input state without selecting it; the returned Pane is still the freshly materialized active pane in the receiver context.
  • PaneCount method PaneCount returns tmux #{window_panes} as int from this Window's materialized window-scoped fields.
  • LinkedSessions method LinkedSessions returns newly allocated shallow copies of materialized sessions containing this window, and reports whether the receiver carries relations at all. It never queries tmux.
  • DisplayMessage method DisplayMessage displays or prints a message at this window's exact target. Print returns an owned stdout slice even on a completed nonzero exit; completed stderr reaches WarningHandler as tmux.WarningCommandStderr. NoExpand follows UnsupportedPolicy. Warnings run synchronously before return; context cancellation does not prove display did not occur.
  • Cmd method Cmd executes a tmux subcommand targeted to the window's stable ID.
  • SessionID method SessionID returns the linked session containing this view.
  • Activity method Activity returns tmux #{window_activity} as time.Time from this Window's materialized window-scoped fields.
  • Linked method Linked returns tmux #{window_linked} as bool from this Window's materialized window-scoped fields.
  • SetHooks method SetHooks applies indexed window hook commands in ascending order at this handle's exact window target. With ClearExisting it confirms clearing first, stops at the first failure without rollback, and reports confirmed progress. Cancellation may follow accepted commands and cannot disprove their delivery.
  • RunHook method RunHook asks tmux to run one window hook directly at this exact target. The receiver's exact linked session context controls tmux format evaluation; no racy preflight is issued. Completed failures are secret-safe option errors; cancellation does not prove execution did not occur.
  • SelectPane method SelectPane makes an exact or relative pane active in the receiver's exact winlink without selecting the window in its session. Target must belong to that same SessionID and WindowID; a PaneID alone does not identify a linked view. The returned Pane is the freshly materialized active pane in the receiver context, not a canonical ID-only view.

Other members112#

Guides#

Pages that discuss Window.

In other ports#

A tmux window

Equivalents of A tmux window in other languages
Language Equivalent
Python libtmux.Window
Ruby LibTmux::Window
Lua libtmux.Window
PowerShell LibTmux\Get-TmuxWindow This cmdlet reads shared .NET LibTmux.Window placements. Use -Server for all sessions or -Session for one session.
Julia LibTmux.WindowSnapshot WindowSnapshot holds captured physical-window data. WindowLink records a placement in a session; actions use WindowRef.
Erlang #tmux_model:window{} A physical window can have several session memberships. window_link holds the session-relative index and active flag.
Elixir LibTmux.Window Window is a physical window. WindowLink records its session index and active state.
Haskell No public Haskell equivalent is implemented; the current modules expose scalar values and version parsing.
Common Lisp libtmux:window window is a physical captured window. window-link preserves each session placement.
TypeScript window.Window
Rust window.Window
Java io.github.libtmux.Window
Clojure libtmux.data/windows Traverses captured window-placement maps without I/O; the window value is a map with an explicit Java reference for effects.
Kotlin io.github.libtmux.kotlin.Window
Scala io.github.libtmux.scaladsl.Window
C# LibTmux.Window
F# LibTmux.FSharp.Window This F# module identifies shared .NET LibTmux.Window placements and builds deferred pane queries. Query.list acquires their results from tmux.
C++ libtmux::Window
Swift Window
OCaml Libtmux.Window.t A global window can have several session placements. Window_link holds the session, index and current flag.
Perl LibTmux::Window Physical window identity. WindowLink owns each session/index placement.
Esc

Type to search.

Reference previewOpen reference