Early release libtmux is released, and its APIs may still change between releases.
This site's structure and URLs may change too.
libtmux for Ruby
Ruby-based tmux client
tmux client library for Ruby. Control tmux, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents
Capability: Navigate tmux via a typed object graph
require"libtmux"
# A private server: its own socket and an empty config, so this neither
# touches nor is changed by a tmux you already use.
list-windows -a -F #{n:window_id}:#{q:window_id}#{n:window_name}:#{q:window_name}#{n:window_width}:#{q:window_width}#{n:window_height}:#{q:window_height}#{n:window_panes}:#{q:window_panes}#{n:window_layout}:#{q:window_layout}#{n:session_id}:#{q:session_id}#{n:window_id}:#{q:window_id}#{n:window_index}:#{q:window_index}#{n:window_active}:#{q:window_active}2:@03:env2:802:241:171:\{\"V\":2,\"L\":\{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"\%0\"\}\}2:\$02:@01:01:1
list-panes -a -F #{n:pane_id}:#{q:pane_id}#{n:window_id}:#{q:window_id}#{n:pane_index}:#{q:pane_index}#{n:pane_pid}:#{q:pane_pid}#{n:pane_current_command}:#{q:pane_current_command}#{n:pane_current_path}:#{q:pane_current_path}#{n:pane_title}:#{q:pane_title}#{n:pane_active}:#{q:pane_active}#{n:pane_dead}:#{q:pane_dead}#{n:pane_dead_status}:#{q:pane_dead_status}#{n:pane_width}:#{q:pane_width}#{n:pane…2:\%02:@01:07:29776673:cat31:/tmp/marked1:d1:11:00:2:802:24
Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
list-windows -a -F #{n:window_id}:#{q:window_id}#{n:window_name}:#{q:window_name}#{n:window_width}:#{q:window_width}#{n:window_height}:#{q:window_height}#{n:window_panes}:#{q:window_panes}#{n:window_layout}:#{q:window_layout}#{n:session_id}:#{q:session_id}#{n:window_id}:#{q:window_id}#{n:window_index}:#{q:window_index}#{n:window_active}:#{q:window_active}2:@06:editor2:802:241:171:\{\"V\":2,\"L\":\{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"\%0\"\}\}2:\$02:@01:01:1
list-panes -a -F #{n:pane_id}:#{q:pane_id}#{n:window_id}:#{q:window_id}#{n:pane_index}:#{q:pane_index}#{n:pane_pid}:#{q:pane_pid}#{n:pane_current_command}:#{q:pane_current_command}#{n:pane_current_path}:#{q:pane_current_path}#{n:pane_title}:#{q:pane_title}#{n:pane_active}:#{q:pane_active}#{n:pane_dead}:#{q:pane_dead}#{n:pane_dead_status}:#{q:pane_dead_status}#{n:pane_width}:#{q:pane_width}#{n:pane…2:\%02:@01:07:29776673:cat31:/tmp/marked1:d1:11:00:2:802:24
Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
list-windows -a -F #{n:window_id}:#{q:window_id}#{n:window_name}:#{q:window_name}#{n:window_width}:#{q:window_width}#{n:window_height}:#{q:window_height}#{n:window_panes}:#{q:window_panes}#{n:window_layout}:#{q:window_layout}#{n:session_id}:#{q:session_id}#{n:window_id}:#{q:window_id}#{n:window_index}:#{q:window_index}#{n:window_active}:#{q:window_active}2:@06:editor2:802:241:2171:\{\"V\":2,\"L\":\{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":\[\{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"l\":0,\"i\":0,\"I\":\"\%0\"\},\{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"a\":true,\"i\":1,\"I\":\"\%1\"\}]\}\}2:\$02:@01:01:0
2:@14:logs2:802:241:171:\{\"V\":2,\"L\":\{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"\%…
list-panes -a -F #{n:pane_id}:#{q:pane_id}#{n:window_id}:#{q:window_id}#{n:pane_index}:#{q:pane_index}#{n:pane_pid}:#{q:pane_pid}#{n:pane_current_command}:#{q:pane_current_command}#{n:pane_current_path}:#{q:pane_current_path}#{n:pane_title}:#{q:pane_title}#{n:pane_active}:#{q:pane_active}#{n:pane_dead}:#{q:pane_dead}#{n:pane_dead_status}:#{q:pane_dead_status}#{n:pane_width}:#{q:pane_width}#{n:pane…2:\%02:@01:07:29776673:cat31:/tmp/marked1:d1:01:00:2:402:24
2:\%12:@01:17:29778492:sh31:/tmp/marked1:d1:11:00:2:392:24
2:\%22:@11:07:29778723:cat31:/tmp/marked1:d1:11:00:2:802:24
Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
POSIX shell, tmux 3.3a or newer, Ruby 4.0.7, Bundler 4.0.20, a C build toolchain for gems and access to rubygems.org.
Save the program above as quickstart.rb in a new directory, along with the files below.
The Ruby block closes its server automatically. Cleanup shows the explicit ensure form.The program stops its private tmux server and removes any temporary files it created when it finishes. Error handling adds diagnostics; every version checks required results and deadlines.
list-windows -a -F #{n:window_id}:#{q:window_id}#{n:window_name}:#{q:window_name}#{n:window_width}:#{q:window_width}#{n:window_height}:#{q:window_height}#{n:window_panes}:#{q:window_panes}#{n:window_layout}:#{q:window_layout}#{n:session_id}:#{q:session_id}#{n:window_id}:#{q:window_id}#{n:window_index}:#{q:window_index}#{n:window_active}:#{q:window_active}2:@03:env2:802:241:171:\{\"V\":2,\"L\":\{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"\%0\"\}\}2:\$02:@01:01:1
2:@14:logs2:802:241:171:\{\"V\":2,\"L\":\{\"t\":\"p\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"\%1\"\}\}2:\$02:@11:11:0
list-panes -a -F #{n:pane_id}:#{q:pane_id}#{n:window_id}:#{q:window_id}#{n:pane_index}:#{q:pane_index}#{n:pane_pid}:#{q:pane_pid}#{n:pane_current_command}:#{q:pane_current_command}#{n:pane_current_path}:#{q:pane_current_path}#{n:pane_title}:#{q:pane_title}#{n:pane_active}:#{q:pane_active}#{n:pane_dead}:#{q:pane_dead}#{n:pane_dead_status}:#{q:pane_dead_status}#{n:pane_width}:#{q:pane_width}#{n:pane…2:\%02:@01:07:25770323:cat31:/tmp/marked1:d1:11:00:2:802:24
2:\%12:@11:07:25770553:cat31:/tmp/marked1:d1:11:00:2:802:24
Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
ReplayHover a call to preview the tmux state after it. Click to pin it.
%0 cat
[docs]0:cat*
tmux before the first call.
%0 cat
[docs]0:cat*
tmux after tmux_capabilities: unchanged, the call only reads.
%1 sh
[checks]0:sh*
tmux after tmux_create.
%1 sh
%2 sh
[checks]0:sh*
tmux after tmux_create.
%1 sh
%2 sh
[checks]0:sh*
tmux after tmux_snapshot: unchanged, the call only reads.
%1 sh
%2 sh
[checks]0:sh*
tmux after tmux_send.
%1 sh
%2 sh
[checks]0:sh*
tmux after tmux_wait.
%1 sh
%2 sh
[checks]0:sh*
tmux after tmux_send.
%1 sh
%2 sh
[checks]0:sh*
tmux after tmux_wait.
%0 cat
[docs]0:cat*
tmux after tmux_close.
you
Create a tmux session called checks, split its window into two panes, run pytest -q in one and show checks.log in the other, show me the results, then remove the session.
agentAsk the server which tools and limits are enabled.
"description": "The Ruby decoder additionally enforces byte, depth and node limits, rejects duplicate keys and floating-point tokens for integer fields.",