agentCreate the session.
Result
{ "session_id": "$0", "session_name": "checks", "window_count": 1, "session_attached": "0", "session_created": "1793756857", "active_pane_id": "%0"}Choose documentation 3
No matching documentation.
No matching versions.
Current version
latestNo matching languages.
Early release libtmux is released, and its APIs may still change between releases. This site's structure and URLs may change too.
Python-based tmux client
tmux client library for Python. Control tmux, connect to and create servers, navigate sessions, windows, and panes, send keys, watch for changes via control mode, capture pane contents
from __future__ import annotations
from pathlib import Pathimport tempfileimport time
import libtmuxfrom libtmux.constants import PaneDirection
directory = Path(tempfile.mkdtemp(prefix="libtmux-py-home-"))socket = directory / "tmux.sock"server = libtmux.Server(socket_path=socket, config_file="/dev/null")
session = server.new_session(session_name="demo")
# Lay out the session: name its window, split it, add a second window.editor = session.active_windoweditor.rename_window("editor")left = editor.active_paneassert left is not Noneright = left.split(direction=PaneDirection.Right, shell="sh")logs = session.new_window(window_name="logs")
# Type a command into the new pane and wait for what it prints.right.send_keys("printf 'hello from %s\\n' tmux", enter=True)deadline = time.monotonic() + 5while "hello from tmux" not in right.capture_pane(): if time.monotonic() >= deadline: raise TimeoutError("The pane did not print hello from tmux") time.sleep(0.02)
# Move the focus an attached client sees: the pane, then the window.right.select()logs.select()
# Walk the objects: down from the server, then up from one pane.sessions = server.sessionsfor each in sessions: print("session", each.session_name) windows = each.windows for window in windows: panes = window.panes ids = " ".join(pane.pane_id for pane in panes) print(f" window {window.window_index}:{window.window_name}: {ids}")window = right.windowowner = window.sessionprint(right.pane_id, "is in window", window.window_name, "of session", owner.session_name)from __future__ import annotations
from pathlib import Pathimport tempfileimport time
import libtmuxfrom libtmux.constants import PaneDirection
directory = Path(tempfile.mkdtemp(prefix="libtmux-py-home-"))socket = directory / "tmux.sock"server = libtmux.Server(socket_path=socket, config_file="/dev/null")
try: session = server.new_session(session_name="demo")
# Lay out the session: name its window, split it, add a second window. editor = session.active_window editor.rename_window("editor") left = editor.active_pane assert left is not None right = left.split(direction=PaneDirection.Right, shell="sh") logs = session.new_window(window_name="logs")
# Type a command into the new pane and wait for what it prints. right.send_keys("printf 'hello from %s\\n' tmux", enter=True) deadline = time.monotonic() + 5 while "hello from tmux" not in right.capture_pane(): if time.monotonic() >= deadline: raise TimeoutError("The pane did not print hello from tmux") time.sleep(0.02)
# Move the focus an attached client sees: the pane, then the window. right.select() logs.select()
# Walk the objects: down from the server, then up from one pane. sessions = server.sessions for each in sessions: print("session", each.session_name) windows = each.windows for window in windows: panes = window.panes ids = " ".join(pane.pane_id for pane in panes) print(f" window {window.window_index}:{window.window_name}: {ids}") window = right.window owner = window.session print(right.pane_id, "is in window", window.window_name, "of session", owner.session_name)except Exception as error: raise RuntimeError("tmux quickstart failed") from errorfrom __future__ import annotations
from pathlib import Pathimport shutilimport tempfileimport time
import libtmuxfrom libtmux.constants import PaneDirection
directory = Path(tempfile.mkdtemp(prefix="libtmux-py-home-"))socket = directory / "tmux.sock"server = libtmux.Server(socket_path=socket, config_file="/dev/null")
try: session = server.new_session(session_name="demo")
# Lay out the session: name its window, split it, add a second window. editor = session.active_window editor.rename_window("editor") left = editor.active_pane assert left is not None right = left.split(direction=PaneDirection.Right, shell="sh") logs = session.new_window(window_name="logs")
# Type a command into the new pane and wait for what it prints. right.send_keys("printf 'hello from %s\\n' tmux", enter=True) deadline = time.monotonic() + 5 while "hello from tmux" not in right.capture_pane(): if time.monotonic() >= deadline: raise TimeoutError("The pane did not print hello from tmux") time.sleep(0.02)
# Move the focus an attached client sees: the pane, then the window. right.select() logs.select()
# Walk the objects: down from the server, then up from one pane. sessions = server.sessions for each in sessions: print("session", each.session_name) windows = each.windows for window in windows: panes = window.panes ids = " ".join(pane.pane_id for pane in panes) print(f" window {window.window_index}:{window.window_name}: {ids}") window = right.window owner = window.session print(right.pane_id, "is in window", window.window_name, "of session", owner.session_name)finally: if socket.exists(): server.kill() shutil.rmtree(directory)from __future__ import annotations
from pathlib import Pathimport shutilimport tempfileimport time
import libtmuxfrom libtmux.constants import PaneDirection
directory = Path(tempfile.mkdtemp(prefix="libtmux-py-home-"))socket = directory / "tmux.sock"server = libtmux.Server(socket_path=socket, config_file="/dev/null")
try: session = server.new_session(session_name="demo")
# Lay out the session: name its window, split it, add a second window. editor = session.active_window editor.rename_window("editor") left = editor.active_pane assert left is not None right = left.split(direction=PaneDirection.Right, shell="sh") logs = session.new_window(window_name="logs")
# Type a command into the new pane and wait for what it prints. right.send_keys("printf 'hello from %s\\n' tmux", enter=True) deadline = time.monotonic() + 5 while "hello from tmux" not in right.capture_pane(): if time.monotonic() >= deadline: raise TimeoutError("The pane did not print hello from tmux") time.sleep(0.02)
# Move the focus an attached client sees: the pane, then the window. right.select() logs.select()
# Walk the objects: down from the server, then up from one pane. sessions = server.sessions for each in sessions: print("session", each.session_name) windows = each.windows for window in windows: panes = window.panes ids = " ".join(pane.pane_id for pane in panes) print(f" window {window.window_index}:{window.window_name}: {ids}") window = right.window owner = window.session print(right.pane_id, "is in window", window.window_name, "of session", owner.session_name)except Exception as error: raise RuntimeError("tmux quickstart failed") from errorfinally: if socket.exists(): server.kill() shutil.rmtree(directory)tmux before the first call: no server is running.
tmux after Server: no server is running; the call sent no command.
tmux after Server.new_session: added session demo.
tmux after Session.active_window: unchanged.
tmux after Window.rename_window: renamed window 0:sh to 0:editor.
tmux after Window.active_pane: unchanged.
tmux after Pane.split: added pane %1 to window 0:editor.
tmux after Session.new_window: added window 1:logs.
tmux after Pane.send_keys: sent keys to pane %1.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Pane.capture_pane: read pane %1.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Pane.select: selected pane %1 in window 0:editor.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Window.select: selected window 1:logs.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Server.sessions: unchanged.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Session.windows: unchanged.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Window.panes: unchanged.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Window.panes: unchanged.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Pane.window: unchanged.
$ printf 'hello from %s\n' tmux hello from tmux $
tmux after Window.session: unchanged.
tmux after Server.kill: the server has exited.
No tmux server is running yet.
Server returned Server { "socketPath": "/tmp/tmp/libtmux-py-home-azy0qyi_/tmux.sock", "configFile": "/dev/null"}The call sent no tmux command.
Server.new_session returned Session { "id": "$0", "name": "demo"}has-session -t =demo error connecting to /tmp/tmp/libtmux-py-home-azy0qyi_/tmux.sock (No such file or directory) new-session -P -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_standar… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞0␞0␞960␞2000␞0␞0␞0␞0␞0␞␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞79␞␞␞/tmp/marked␞0␞8,16,24,32,40,48,56,64,72␞host␞0␞/dev/pts/14␞80␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/libtmux-d… Before these, the library asked tmux about itself 1 time (its version, its daemon, how a control client reads escapes).
Session.active_window returned Window { "id": "@0", "index": "0", "name": "sh"}list-windows -t $0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞79␞␞␞/tmp/marked␞0␞8,16,24,32,40,48,56,64,72␞host␞0␞/dev/pts/14␞80␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/libtmux… Window.rename_window returned Window { "id": "@0", "index": "0", "name": "editor"}rename-window -t @0 editor no output list-windows -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞79␞␞␞/tmp/marked␞0␞8,16,24,32,40,48,56,64,72␞host␞0␞/dev/pts/14␞80␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/libtmux… Window.active_pane returned Pane { "id": "%0"}list-panes -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_stand… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞1␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞79␞␞␞/tmp/marked␞0␞8,16,24,32,40,48,56,64,72␞host␞0␞/dev/pts/14␞80␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/libtmux… Pane.split returned Pane { "id": "%1"}split-window -t %0 -h -P -F#{pane_id}␞ -d sh %1␞ list-panes -t %1 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_stand… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞2␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞1␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/tm… list-windows -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/tm… list-sessions -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_standard… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞0␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞1␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/tm… list-windows -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/tm… list-sessions -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_standard… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞0␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞1␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/tm… list-windows -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/tm… list-windows -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞1␞/tmp/tm… Session.new_window returned Window { "id": "@1", "index": "1", "name": "logs"}new-window -t $0: -d -P -F#{window_id} -n logs -t$0: @1 list-windows -t @1 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞1␞2␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%0␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞2␞/tmp/tm… Pane.send_keys returned None nullsend-keys -t %1 'printf '\''hello from %s\n'\'' tmux' no output send-keys -t %1 Enter no output Pane.capture_pane returned list[str] [ "$ printf 'hello from %s\\n' tmux", "hello from tmux", "$"]capture-pane -t %1 -p $ printf 'hello from %s\n' tmux
hello from tmux
$ Pane.select returned Pane { "id": "%1"}select-pane -t %1 no output list-panes -t %1 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_stand… 0␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞1␞2␞0␞0␞0␞0␞0␞$1␞0␞0␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞-␞0␞1␞24␞%0␞0␞0␞0␞1␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞0␞2␞/tmp/tm… Window.select returned Window { "id": "@1", "index": "1", "name": "logs"}select-window -t @1 no output list-windows -t @1 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 1␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞2␞1295␞2000␞0␞0␞0␞0␞1␞2␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞0␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%1␞0␞1␞0␞0␞41␞0␞0␞␞␞0␞hidden␞2890032␞0␞␞79␞␞sh␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/16␞39␞41␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞1,0␞2␞/tmp/libtmux-docs-7y8… Server.sessions returned QueryList[Session] [ "$0"]list-sessions -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_standard… 1␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%2␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2890194␞0␞␞79␞␞␞/tmp/marked␞0␞8,16,24,32,40,48,56,64,72␞host␞0␞/dev/pts/17␞80␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞1␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞1,0␞2␞/tmp/libtm… Session.windows returned QueryList[Window] [ "@0", "@1"]list-windows -t $0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 1␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞2␞1295␞2000␞0␞0␞0␞0␞1␞2␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞0␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%1␞0␞1␞0␞0␞41␞0␞0␞␞␞0␞hidden␞2890032␞0␞␞79␞␞sh␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/16␞39␞41␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞1,0␞2␞/tmp/libtmux-docs-7y8… Window.panes returned QueryList[Pane] [ "%0", "%1"]list-panes -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_stand… 1␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞1␞2␞0␞0␞0␞0␞0␞$1␞0␞0␞1␞1␞0␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞-␞0␞1␞24␞%0␞0␞0␞0␞1␞0␞0␞0␞␞␞0␞hidden␞2889449␞0␞␞39␞␞␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/14␞40␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞1,0␞2␞/tmp/… Window.panes returned QueryList[Pane] [ "%2"]list-panes -t @1 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_stand… 1␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞1␞1␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞1␞24␞%2␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2890194␞0␞␞79␞␞␞/tmp/marked␞0␞8,16,24,32,40,48,56,64,72␞host␞0␞/dev/pts/17␞80␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞1,0␞2␞/tmp/libtm… Pane.window returned Window { "id": "@0", "index": "0", "name": "editor"}list-windows -t @0 -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_sta… 1␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞2␞1295␞2000␞0␞0␞0␞0␞1␞2␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞0␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%1␞0␞1␞0␞0␞41␞0␞0␞␞␞0␞hidden␞2890032␞0␞␞79␞␞sh␞/tmp/marked␞0␞8,16,24,32␞host␞0␞/dev/pts/16␞39␞41␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞0␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞1,0␞2␞/tmp/libtmux-docs-7y8… Window.session returned Session { "id": "$0", "name": "demo"}list-sessions -F#{active_window_index}␞#{alternate_saved_x}␞#{alternate_saved_y}␞#{bracket_paste_flag}␞#{config_files}␞#{cursor_character}␞#{cursor_flag}␞#{cursor_x}␞#{cursor_y}␞#{history_bytes}␞#{history_limit}␞#{history_size}␞#{insert_flag}␞#{keypad_cursor_flag}␞#{keypad_flag}␞#{last_window_index}␞#{line}␞#{mouse_all_flag}␞#{mouse_any_flag}␞#{mouse_button_flag}␞#{mouse_sgr_flag}␞#{mouse_standard… 1␞4294967295␞4294967295␞0␞/dev/null␞ ␞1␞2␞0␞1060␞2000␞0␞0␞0␞0␞1␞0␞0␞0␞0␞0␞0␞$1␞0␞1␞1␞1␞1␞1␞default␞23␞sh␞/tmp/marked␞0␞␞␞␞default␞*␞0␞0␞24␞%2␞0␞0␞0␞0␞0␞0␞0␞␞␞0␞hidden␞2890194␞0␞␞79␞␞␞/tmp/marked␞0␞8,16,24,32,40,48,56,64,72␞host␞0␞/dev/pts/17␞80␞0␞0␞1␞0␞2889448␞23␞0␞1793886161␞␞0␞␞1793886161␞1␞␞␞␞␞␞␞0␞$0␞␞0␞0␞demo␞/tmp/marked␞1,0␞2␞/tmp/libtm… Server.kill returned None nullkill-server no output POSIX shell, tmux 3.2a or newer, Python 3.14.6 and uv (tested 0.12.0).
Save the program above as quickstart.py in a new directory, along with the files below.
Cleanup is omitted; the private tmux server and its temporary files may remain. Select Cleanup to remove them when the program finishes. 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.
uv venv .venvuv pip install --python .venv/bin/python libtmux==0.62.0unset TMUX TMUX_PANEexport ENV=/dev/null BASH_ENV=/dev/null SHELL=/bin/sh.venv/bin/python quickstart.pysession demo window 0:editor: %0 %1 window 1:logs: %2%1 is in window editor of session demolibtmuxDependency cooldowns
The checkbox turns a cooldown on and off for every picker on the site. It applies to what an install pulls in; the package itself, and the libtmux it pins, stay current.
Cooldowns delay picking up newly uploaded packages so the community has time to spot supply-chain attacks before you install. Most package managers don't apply one by default; you opt in through a global setting in your tool's configuration.
Learn more at cooldowns.dev · Datadog Security Labs writeup.
$ pip install libtmux$ pip install libtmuxpip cannot exempt libtmux from its own cooldown, so a cooldown here would also hold back the release this installs. This command runs without one.
$ pip install libtmuxpip cannot exempt libtmux from its own cooldown, so a cooldown here would also hold back the release this installs. This command runs without one.
$ uv add libtmux$ uv add --no-config libtmux$ pipx install libtmux$ pipx install libtmuxpipx cannot exempt libtmux from its own cooldown, so a cooldown here would also hold back the release this installs. This command runs without one.
$ pipx install libtmuxpipx cannot exempt libtmux from its own cooldown, so a cooldown here would also hold back the release this installs. This command runs without one.
tmux before the first call.
tmux after create_session.
tmux after split_window.
tmux after list_windows: unchanged, the call only reads.
$ pytest -q $ ( pytest -q .. [100%] 2 passed in 0.00s $
tmux after run_command.
$ pytest -q $ ( pytest -q .. [100%] 2 passed in 0.00s $
$ cat checks.log $ ( cat checks.log 2026-01-01 checks started 2026-01-01 checks finished $
tmux after run_command.
tmux after kill_session.
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.
agentCreate the session.
{ "session_id": "$0", "session_name": "checks", "window_count": 1, "session_attached": "0", "session_created": "1793756857", "active_pane_id": "%0"}agentSplit the pane the create result returned (%0) in two.
{ "pane_id": "%1", "pane_index": "1", "pane_width": "39", "pane_height": "24", "pane_left": 41, "pane_top": 0, "pane_right": 79, "pane_bottom": 23, "pane_at_left": false, "pane_at_right": true, "pane_at_top": true, "pane_at_bottom": true, "…": "9 more"}agentRead the window's layout.
{ "result": [ { "window_id": "@0", "window_name": "sh", "window_index": "0", "session_id": "$0", "session_name": "checks", "pane_count": 2, "window_layout": "{\"V\":2,\"L\":{\"t\":\"h\",\"w\":80,\"h\":24,\"x\":0,\"y\":0,\"c\":[{\"t\":\"p\",\"w\":40,\"h\":24,\"x\":0,\"y\":0,\"a\":true,\"i\":0,\"I\":\"%0\"},{\"t\":\"p\",\"w\":39,\"h\":24,\"x\":41,\"y\":0,\"i\":1,\"I\":\"%1\"}]}}", "window_active": "1", "window_width": "80", "window_height": "24", "active_pane_id": "%0" } ]}agentRun the tests in the pane the create result returned (%0).
{ "pane_id": "%0", "exit_status": 0, "timed_out": false, "elapsed_seconds": 0.3231329689733684, "output": [ "$ (", "pytest -q", ".. [100%]", "2 passed in 0.00s", "… 1 more" ], "output_truncated": false, "output_truncated_lines": 0, "effective_timeout": 30}agentShow the log in the new pane the split returned (%1).
{ "pane_id": "%1", "exit_status": 0, "timed_out": false, "elapsed_seconds": 0.009672012005466968, "output": [ "$ (", "cat checks.log", "2026-01-01 checks started", "2026-01-01 checks finished", "… 1 more" ], "output_truncated": false, "output_truncated_lines": 0, "effective_timeout": 30}agentRemove the session once the result is read.
{ "result": "Session killed: checks"}agent in %0 it printed 2 passed in 0.00s
; in %1 it printed 2026-01-01 checks finished
.
libtmux-mcpChoose your client and configuration scope, then run the command or paste the configuration.
With uvx installed:
$ claude mcp add tmux -- uvx libtmux-mcp
Config file: ~/.claude.json (this project)
With uvx installed:
Config file: ~/.claude.json (this project)
With uvx installed:
$ claude mcp add tmux -- uvx --no-config libtmux-mcp
Config file: ~/.claude.json (this project)
With uvx installed:
$ claude mcp add tmux --scope user -- uvx libtmux-mcp
Config file: ~/.claude.json (all projects)
With uvx installed:
Config file: ~/.claude.json (all projects)
With uvx installed:
$ claude mcp add tmux --scope user -- uvx --no-config libtmux-mcp
Config file: ~/.claude.json (all projects)
With uvx installed:
$ claude mcp add tmux --scope project -- uvx libtmux-mcp
Config file: .mcp.json (in repo, version-controlled)
With uvx installed:
Config file: .mcp.json (in repo, version-controlled)
With uvx installed:
$ claude mcp add tmux --scope project -- uvx --no-config libtmux-mcp
Config file: .mcp.json (in repo, version-controlled)
With pipx installed:
$ claude mcp add tmux -- pipx run libtmux-mcp
Config file: ~/.claude.json (this project)
With pipx installed:
$ claude mcp add tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (this project)
With pipx installed:
$ claude mcp add tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (this project)
With pipx installed:
$ claude mcp add tmux --scope user -- pipx run libtmux-mcp
Config file: ~/.claude.json (all projects)
With pipx installed:
$ claude mcp add tmux --scope user -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (all projects)
With pipx installed:
$ claude mcp add tmux --scope user -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (all projects)
With pipx installed:
$ claude mcp add tmux --scope project -- pipx run libtmux-mcp
Config file: .mcp.json (in repo, version-controlled)
With pipx installed:
$ claude mcp add tmux --scope project -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .mcp.json (in repo, version-controlled)
With pipx installed:
$ claude mcp add tmux --scope project -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .mcp.json (in repo, version-controlled)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux -- libtmux-mcp
Config file: ~/.claude.json (this project)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (this project)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (this project)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux --scope user -- libtmux-mcp
Config file: ~/.claude.json (all projects)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux --scope user -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (all projects)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux --scope user -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.claude.json (all projects)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux --scope project -- libtmux-mcp
Config file: .mcp.json (in repo, version-controlled)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux --scope project -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .mcp.json (in repo, version-controlled)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ claude mcp add tmux --scope project -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .mcp.json (in repo, version-controlled)
With uvx installed:
Config file: claude_desktop_config.json
With uvx installed:
Config file: claude_desktop_config.json
With uvx installed:
Config file: claude_desktop_config.json
With pipx installed:
Config file: claude_desktop_config.json
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: claude_desktop_config.json
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: claude_desktop_config.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
Config file: claude_desktop_config.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: claude_desktop_config.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: claude_desktop_config.json
With uvx installed:
Config file: ~/.codex/config.toml
With uvx installed:
$ codex mcp add tmux -- uvx --no-config libtmux-mcp
Config file: ~/.codex/config.toml
With uvx installed:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Config file: .codex/config.toml (in repo)
With uvx installed:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Config file: .codex/config.toml (in repo)
With uvx installed:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Config file: .codex/config.toml (in repo)
With pipx installed:
$ codex mcp add tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.codex/config.toml
With pipx installed:
$ codex mcp add tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.codex/config.toml
With pipx installed:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Config file: .codex/config.toml (in repo)
With pipx installed:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .codex/config.toml (in repo)
With pipx installed:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .codex/config.toml (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ codex mcp add tmux -- libtmux-mcp
Config file: ~/.codex/config.toml
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ codex mcp add tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.codex/config.toml
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ codex mcp add tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.codex/config.toml
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
Config file: .codex/config.toml (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .codex/config.toml (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .codex/config.toml (in repo)
With uvx installed:
$ gemini mcp add --scope user tmux uvx -- libtmux-mcp
Config file: ~/.gemini/settings.json
With uvx installed:
Config file: ~/.gemini/settings.json
With uvx installed:
$ gemini mcp add --scope user tmux uvx -- --no-config libtmux-mcp
Config file: ~/.gemini/settings.json
With uvx installed:
$ gemini mcp add --scope project tmux uvx -- libtmux-mcp
Config file: .gemini/settings.json (in repo)
With uvx installed:
Config file: .gemini/settings.json (in repo)
With uvx installed:
$ gemini mcp add --scope project tmux uvx -- --no-config libtmux-mcp
Config file: .gemini/settings.json (in repo)
With pipx installed:
$ gemini mcp add --scope user tmux pipx -- run libtmux-mcp
Config file: ~/.gemini/settings.json
With pipx installed:
$ gemini mcp add --scope user tmux pipx -- run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/settings.json
With pipx installed:
$ gemini mcp add --scope user tmux pipx -- run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/settings.json
With pipx installed:
$ gemini mcp add --scope project tmux pipx -- run libtmux-mcp
Config file: .gemini/settings.json (in repo)
With pipx installed:
$ gemini mcp add --scope project tmux pipx -- run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .gemini/settings.json (in repo)
With pipx installed:
$ gemini mcp add --scope project tmux pipx -- run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .gemini/settings.json (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ gemini mcp add --scope user tmux libtmux-mcp
Config file: ~/.gemini/settings.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ gemini mcp add --scope user tmux libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/settings.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ gemini mcp add --scope user tmux libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/settings.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ gemini mcp add --scope project tmux libtmux-mcp
Config file: .gemini/settings.json (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ gemini mcp add --scope project tmux libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .gemini/settings.json (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ gemini mcp add --scope project tmux libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .gemini/settings.json (in repo)
With uvx installed:
Config file: .cursor/mcp.json (in repo)
With uvx installed:
Config file: .cursor/mcp.json (in repo)
With uvx installed:
Config file: .cursor/mcp.json (in repo)
With uvx installed:
Config file: ~/.cursor/mcp.json
With uvx installed:
Config file: ~/.cursor/mcp.json
With uvx installed:
Config file: ~/.cursor/mcp.json
With pipx installed:
Config file: .cursor/mcp.json (in repo)
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .cursor/mcp.json (in repo)
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .cursor/mcp.json (in repo)
With pipx installed:
Config file: ~/.cursor/mcp.json
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.cursor/mcp.json
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.cursor/mcp.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
Config file: .cursor/mcp.json (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .cursor/mcp.json (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: .cursor/mcp.json (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
Config file: ~/.cursor/mcp.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.cursor/mcp.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.cursor/mcp.json
With uvx installed:
$ grok mcp add --scope user tmux -- uvx libtmux-mcp
Config file: ~/.grok/config.toml
With uvx installed:
Config file: ~/.grok/config.toml
With uvx installed:
$ grok mcp add --scope user tmux -- uvx --no-config libtmux-mcp
Config file: ~/.grok/config.toml
With uvx installed:
$ grok mcp add --scope project tmux -- uvx libtmux-mcp
Config file: ./.grok/config.toml (in repo)
With uvx installed:
Config file: ./.grok/config.toml (in repo)
With uvx installed:
$ grok mcp add --scope project tmux -- uvx --no-config libtmux-mcp
Config file: ./.grok/config.toml (in repo)
With pipx installed:
$ grok mcp add --scope user tmux -- pipx run libtmux-mcp
Config file: ~/.grok/config.toml
With pipx installed:
$ grok mcp add --scope user tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.grok/config.toml
With pipx installed:
$ grok mcp add --scope user tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.grok/config.toml
With pipx installed:
$ grok mcp add --scope project tmux -- pipx run libtmux-mcp
Config file: ./.grok/config.toml (in repo)
With pipx installed:
$ grok mcp add --scope project tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ./.grok/config.toml (in repo)
With pipx installed:
$ grok mcp add --scope project tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ./.grok/config.toml (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ grok mcp add --scope user tmux -- libtmux-mcp
Config file: ~/.grok/config.toml
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ grok mcp add --scope user tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.grok/config.toml
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ grok mcp add --scope user tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.grok/config.toml
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ grok mcp add --scope project tmux -- libtmux-mcp
Config file: ./.grok/config.toml (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ grok mcp add --scope project tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ./.grok/config.toml (in repo)
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ grok mcp add --scope project tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ./.grok/config.toml (in repo)
With uvx installed:
Config file: ~/.gemini/config/mcp_config.json
With uvx installed:
Config file: ~/.gemini/config/mcp_config.json
With uvx installed:
Config file: ~/.gemini/config/mcp_config.json
With pipx installed:
Config file: ~/.gemini/config/mcp_config.json
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/config/mcp_config.json
With pipx installed:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/config/mcp_config.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
Config file: ~/.gemini/config/mcp_config.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/config/mcp_config.json
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen use this config:
pip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.gemini/config/mcp_config.json
With uvx installed:
$ opencode mcp add tmux -- uvx libtmux-mcp
Config file: ~/.config/opencode/opencode.jsonc
With uvx installed:
Config file: ~/.config/opencode/opencode.jsonc
With uvx installed:
$ opencode mcp add tmux -- uvx --no-config libtmux-mcp
Config file: ~/.config/opencode/opencode.jsonc
With pipx installed:
$ opencode mcp add tmux -- pipx run libtmux-mcp
Config file: ~/.config/opencode/opencode.jsonc
With pipx installed:
$ opencode mcp add tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.config/opencode/opencode.jsonc
With pipx installed:
$ opencode mcp add tmux -- pipx run libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.config/opencode/opencode.jsonc
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ opencode mcp add tmux -- libtmux-mcp
Config file: ~/.config/opencode/opencode.jsonc
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ opencode mcp add tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.config/opencode/opencode.jsonc
Install the packages first:
$ pip install --user --upgrade libtmux libtmux-mcpThen register:
$ opencode mcp add tmux -- libtmux-mcppip has no per-package cooldown override, so this snippet runs without cooldown enforcement. Switch to the uvx tab — it applies the cooldown to transitive deps via `--exclude-newer` while exempting libtmux-mcp itself via `--exclude-newer-package`.
Config file: ~/.config/opencode/opencode.jsonc
Use the Configure cooldowns checkbox above to enable or disable. These settings choose how cooldown behaves once enabled.
Cooldowns delay picking up newly uploaded packages so the community has time to spot supply-chain attacks before you install. Most package managers don't apply one by default — you opt in via a global setting in your tool's config.
Learn more at cooldowns.dev · Datadog Security Labs writeup .
from fastmcp import Client
from libtmux_mcp.server import build_mcp_server
window = mcp_session.active_window
async def _call() -> t.Any: async with Client(build_mcp_server()) as client: return await client.call_tool( "list_panes", { "window_id": window.window_id, "socket_name": mcp_server.socket_name, }, raise_on_error=False, )
result = asyncio.run(_call())
Excerpt of tests/test_window_tools.py,
which uv run py.test runs in the repository's CI
(.github/workflows/tests.yml).
The main-horizontal layout gives the first pane the top of the window and splits the rest below it.
session_name: sample workspacestart_directory: '~'windows:- window_name: test layout: main-horizontal panes: - shell_command: - cmd: vim - shell_command: - cmd: echo "hey" - shell_command: - cmd: echo "moo"{ "session_name": "sample workspace", "start_directory": "~", "windows": [ { "window_name": "test", "layout": "main-horizontal", "panes": [ { "shell_command": [ { "cmd": "vim" } ] }, { "shell_command": [ { "cmd": "echo \"hey\"" } ] }, { "shell_command": [ { "cmd": "echo \"moo\"" } ] } ] } ]}
Workspace file: tests/fixtures/workspace/builder/three_pane.yaml.
Tested by test_layout_main_horizontal
(tests/workspace/test_builder.py; built by the library in a test; the command is not run).
A pane can be one command written as a string, and a command list can be one string.
session_name: sample workspacestart_directory: '~'windows:- window_name: focused window layout: main-horizontal focus: true panes: - shell_command: - cd ~ - shell_command: - cd /usr focus: true - shell_command: - cd ~ - echo "moo" - top- window_name: window 2 panes: - shell_command: - top focus: true - shell_command: - echo "hey" - shell_command: - echo "moo"- window_name: window 3 panes: - shell_command: cd / focus: true - pane - pane{ "session_name": "sample workspace", "start_directory": "~", "windows": [ { "window_name": "focused window", "layout": "main-horizontal", "focus": true, "panes": [ { "shell_command": [ "cd ~" ] }, { "shell_command": [ "cd /usr" ], "focus": true }, { "shell_command": [ "cd ~", "echo \"moo\"", "top" ] } ] }, { "window_name": "window 2", "panes": [ { "shell_command": [ "top" ], "focus": true }, { "shell_command": [ "echo \"hey\"" ] }, { "shell_command": [ "echo \"moo\"" ] } ] }, { "window_name": "window 3", "panes": [ { "shell_command": "cd /", "focus": true }, "pane", "pane" ] } ]}
Workspace file: tests/fixtures/workspace/expand2-unexpanded.yaml.
Tested by test_workspace_expand2
(tests/workspace/test_config.py; loaded by the library in a test; the command is not run).
A window of two panes.
session_name: sample workspacestart_directory: '~'windows:- layout: main-vertical panes: - shell_command: - cmd: vim - shell_command: - cmd: echo "hey" window_name: editor- panes: - shell_command: - cmd: tail | echo 'hi' window_name: logging- window_name: test panes: - shell_command: - cmd: htop{ "session_name": "sample workspace", "start_directory": "~", "windows": [ { "layout": "main-vertical", "panes": [ { "shell_command": [ { "cmd": "vim" } ] }, { "shell_command": [ { "cmd": "echo \"hey\"" } ] } ], "window_name": "editor" }, { "panes": [ { "shell_command": [ { "cmd": "tail | echo 'hi'" } ] } ], "window_name": "logging" }, { "window_name": "test", "panes": [ { "shell_command": [ { "cmd": "htop" } ] } ] } ]}
Workspace file: tests/fixtures/workspace/builder/two_pane.yaml.
Tested by test_split_windows
(tests/workspace/test_builder.py; built by the library in a test; the command is not run).
shell_command_before runs ahead of a pane's own commands, at the session, window or pane level.
shell_command_before: - 'echo "hi"'session_name: 'test'windows:- window_name: editor panes: - shell_command: - vim - :Ex - pane - cd /usr- window_name: logging panes: - shell_command: - - shell_command: - top - emacs{ "shell_command_before": [ "echo \"hi\"" ], "session_name": "test", "windows": [ { "window_name": "editor", "panes": [ { "shell_command": [ "vim", ":Ex" ] }, "pane", "cd /usr" ] }, { "window_name": "logging", "panes": [ { "shell_command": [ null ] }, { "shell_command": [ "top", "emacs" ] } ] } ]}
Workspace file: tests/fixtures/workspace/shell_command_before_session.yaml.
Tested by test_in_session_scope
(tests/workspace/test_config.py; loaded by the library in a test; the command is not run).
environment sets variables for a session, a window or a pane.
session_name: test env varsstart_directory: "~"environment: FOO: SESSION PATH: /tmpwindows:- window_name: no_overrides panes: - pane- window_name: window_overrides environment: FOO: WINDOW panes: - pane- window_name: pane_overrides panes: - environment: FOO: PANE- window_name: both_overrides environment: FOO: WINDOW panes: - pane - environment: FOO: PANE# This test case it just needed for warnings issued in old versions of tmux.- window_name: both_overrides_on_first_pane environment: FOO: WINDOW panes: - environment: FOO: PANE{ "session_name": "test env vars", "start_directory": "~", "environment": { "FOO": "SESSION", "PATH": "/tmp" }, "windows": [ { "window_name": "no_overrides", "panes": [ "pane" ] }, { "window_name": "window_overrides", "environment": { "FOO": "WINDOW" }, "panes": [ "pane" ] }, { "window_name": "pane_overrides", "panes": [ { "environment": { "FOO": "PANE" } } ] }, { "window_name": "both_overrides", "environment": { "FOO": "WINDOW" }, "panes": [ "pane", { "environment": { "FOO": "PANE" } } ] }, { "window_name": "both_overrides_on_first_pane", "environment": { "FOO": "WINDOW" }, "panes": [ { "environment": { "FOO": "PANE" } } ] } ]}
Workspace file: tests/fixtures/workspace/builder/environment_vars.yaml.
Tested by test_environment_variables
(tests/workspace/test_builder.py; built by the library in a test; the command is not run).
start_directory chooses where a session, a window or a pane starts.
session_name: sample workspacewindows: - panes: - start_directory: /usr - start_directory: /etc{ "session_name": "sample workspace", "windows": [ { "panes": [ { "start_directory": "/usr" }, { "start_directory": "/etc" } ] } ]}
Workspace file: tests/fixtures/workspace/builder/first_pane_start_directory.yaml.
Tested by test_first_pane_start_directory
(tests/workspace/test_builder.py; built by the library in a test; the command is not run).
An empty entry, null, pane or blank opens a pane with no command.
session_name: Blank pane testwindows: # Emptiness will simply open a blank pane, if no shell_command_before. # All these are equivalent - window_name: Blank pane test panes: - - pane - blank - window_name: More blank panes panes: - null - shell_command: - shell_command: - # an empty string will be treated as a carriage return - window_name: Empty string (return) panes: - "" - shell_command: "" - shell_command: - "" # a pane can have other options but still be blank - window_name: Blank with options panes: - focus: true - start_directory: /tmp{ "session_name": "Blank pane test", "windows": [ { "window_name": "Blank pane test", "panes": [ null, "pane", "blank" ] }, { "window_name": "More blank panes", "panes": [ null, { "shell_command": null }, { "shell_command": [ null ] } ] }, { "window_name": "Empty string (return)", "panes": [ "", { "shell_command": "" }, { "shell_command": [ "" ] } ] }, { "window_name": "Blank with options", "panes": [ { "focus": true }, { "start_directory": "/tmp" } ] } ]}
Workspace file: examples/blank-panes.yaml.
Tested by test_blank_pane_spawn
(tests/workspace/test_builder.py; built by the library in a test; the command is not run).
tmuxpThe workspace package is separate from the core library.
$ uv tool install tmuxpInstalls tmuxp in an isolated Python environment. Run tmuxp load ./workspace.yaml.
$ uvx tmuxp --helpRuns without a permanent installation. Replace --help with load ./workspace.yaml to load a workspace.
$ pipx install tmuxpInstalls the tmuxp command in an isolated Python environment.
>>> import yaml
>>> session_config = yaml.load('''... session_name: sample workspace... start_directory: '~'... windows:... - window_name: editor... layout: main-vertical... panes:... - shell_command:... - cmd: vim... - shell_command:... - cmd: echo "hey"...... - window_name: logging... panes:... - shell_command:... - cmd: tail | echo 'hi'...... - window_name: test... panes:... - shell_command:... - cmd: htop... ''', Loader=yaml.Loader)
>>> builder = ClassicWorkspaceBuilder(session_config=session_config, server=server)
**New session:**
>>> builder.build()
>>> new_session = builder.session
>>> new_session.name == 'sample workspace'True
Excerpt of src/tmuxp/workspace/builder/classic.py,
which uv run py.test runs in the repository's CI
(.github/workflows/tests.yml).
Subject-by-subject, with Python in every code block.
Task guides for Python.
Complete programs, sourced from the code each port tests.
The domain model every port shares.
Reference preview