PythonHome

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.

MoreLess about this notice

libtmux for Python

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

Product

Control tmux from Python code 0.x Released; the API may change. Read more Core Library home →

from __future__ import annotations
from pathlib import Path
import tempfile
import time
import libtmux
from 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_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)
from __future__ import annotations
from pathlib import Path
import tempfile
import time
import libtmux
from 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 error
from __future__ import annotations
from pathlib import Path
import shutil
import tempfile
import time
import libtmux
from 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 Path
import shutil
import tempfile
import time
import libtmux
from 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 error
finally:
if socket.exists():
server.kill()
shutil.rmtree(directory)
Example details
No tmux server yet

tmux before the first call: no server is running.

No tmux server yet

tmux after Server: no server is running; the call sent no command.

%0 sh
[demo]

tmux after Server.new_session: added session demo.

%0 sh
[demo]

tmux after Session.active_window: unchanged.

%0 sh
[demo]

tmux after Window.rename_window: renamed window 0:sh to 0:editor.

%0 sh
[demo]

tmux after Window.active_pane: unchanged.

%0 sh
%1 sh
[demo]

tmux after Pane.split: added pane %1 to window 0:editor.

%0 sh
%1 sh
[demo]

tmux after Session.new_window: added window 1:logs.

%0 sh
%1 sh
[demo]

tmux after Pane.send_keys: sent keys to pane %1.

%0 sh
%1 sh
$ printf 'hello from %s\n' tmux
hello from tmux
$
[demo]

tmux after Pane.capture_pane: read pane %1.

%0 sh
%1 sh
$ printf 'hello from %s\n' tmux
hello from tmux
$
[demo]

tmux after Pane.select: selected pane %1 in window 0:editor.

%2 sh
[demo]

tmux after Window.select: selected window 1:logs.

%2 sh
[demo]

tmux after Server.sessions: unchanged.

%2 sh
[demo]

tmux after Session.windows: unchanged.

%2 sh
[demo]

tmux after Window.panes: unchanged.

%2 sh
[demo]

tmux after Window.panes: unchanged.

%2 sh
[demo]

tmux after Pane.window: unchanged.

%2 sh
[demo]

tmux after Window.session: unchanged.

No sessions

tmux after Server.kill: the server has exited.

  1. Before the first call

    No tmux server is running yet.

  2. Server returned Server

    {
    "socketPath": "/tmp/tmp/libtmux-py-home-azy0qyi_/tmux.sock",
    "configFile": "/dev/null"
    }

    The call sent no tmux command.

  3. Server.new_session returned Session

    {
    "id": "$0",
    "name": "demo"
    }
    2 tmux commands, 1 that changes tmux
    1. has-session -t =demo error connecting to /tmp/tmp/libtmux-py-home-azy0qyi_/tmux.sock (No such file or directory)
    2. 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).

  4. Session.active_window returned Window

    {
    "id": "@0",
    "index": "0",
    "name": "sh"
    }
    1 tmux command
    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… 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…
  5. Window.rename_window returned Window

    {
    "id": "@0",
    "index": "0",
    "name": "editor"
    }
    2 tmux commands, 1 that changes tmux
    1. rename-window -t @0 editor no output
    2. 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…
  6. Window.active_pane returned Pane

    {
    "id": "%0"
    }
    1 tmux command
    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… 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…
  7. Pane.split returned Pane

    {
    "id": "%1"
    }
    8 tmux commands, 1 that changes tmux
    1. split-window -t %0 -h -P -F#{pane_id}␞ -d sh %1␞
    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… 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…
    3. 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…
    4. 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…
    5. 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…
    6. 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…
    7. 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…
    8. 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…
  8. Session.new_window returned Window

    {
    "id": "@1",
    "index": "1",
    "name": "logs"
    }
    2 tmux commands, 1 that changes tmux
    1. new-window -t $0: -d -P -F#{window_id} -n logs -t$0: @1
    2. 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…
  9. Pane.send_keys returned None

    null
    2 tmux commands, 2 that change tmux
    1. send-keys -t %1 'printf '\''hello from %s\n'\'' tmux' no output
    2. send-keys -t %1 Enter no output
  10. Pane.capture_pane returned list[str]

    [
    "$ printf 'hello from %s\\n' tmux",
    "hello from tmux",
    "$"
    ]
    1 tmux command
    1. capture-pane -t %1 -p $ printf 'hello from %s\n' tmux hello from tmux $
  11. Pane.select returned Pane

    {
    "id": "%1"
    }
    2 tmux commands, 1 that changes tmux
    1. select-pane -t %1 no output
    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… 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…
  12. Window.select returned Window

    {
    "id": "@1",
    "index": "1",
    "name": "logs"
    }
    2 tmux commands, 1 that changes tmux
    1. select-window -t @1 no output
    2. 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…
  13. Server.sessions returned QueryList[Session]

    [
    "$0"
    ]
    1 tmux command
    1. 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…
  14. Session.windows returned QueryList[Window]

    [
    "@0",
    "@1"
    ]
    1 tmux command
    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…
  15. Window.panes returned QueryList[Pane]

    [
    "%0",
    "%1"
    ]
    1 tmux command
    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/…
  16. Window.panes returned QueryList[Pane]

    [
    "%2"
    ]
    1 tmux command
    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… 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…
  17. Pane.window returned Window

    {
    "id": "@0",
    "index": "0",
    "name": "editor"
    }
    1 tmux command
    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…
  18. Window.session returned Session

    {
    "id": "$0",
    "name": "demo"
    }
    1 tmux command
    1. 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…
  19. Server.kill returned None

    null
    1 tmux command, 1 that changes tmux
    1. kill-server no output
1/17
Run this example

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.

Setup and run

uv venv .venv
uv pip install --python .venv/bin/python libtmux==0.62.0
unset TMUX TMUX_PANE
export ENV=/dev/null BASH_ENV=/dev/null SHELL=/bin/sh
.venv/bin/python quickstart.py

Expected output

session demo
window 0:editor: %0 %1
window 1:logs: %2
%1 is in window editor of session demo

Install libtmux

From Git
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
libtmux 0.62.0 0.x PyPI
$ pip install libtmux
Cooldown pip 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 libtmux
Cooldown pip has no flag to bypass a cooldown set in its configuration, so this command is unchanged.
$ pip install libtmux
$ uv add libtmux
Cooldown ; libtmux itself stays current.
$ uv add \
    --exclude-newer P7D \
    --exclude-newer-package libtmux=2099-01-01 \
    libtmux
Cooldown Bypasses a cooldown set in your uv configuration, for this install only.
$ uv add --no-config libtmux
$ pipx install libtmux
Cooldown pipx 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 libtmux
Cooldown pipx has no flag to bypass a cooldown set in its configuration, so this command is unchanged.
$ pipx install libtmux
$ uv add "libtmux @ git+https://github.com/tmux-python/libtmux@v0.62.0"

Pins the tagged source; the registry release is the default.

MCP

Give an assistant tmux tools pre-alpha Early development; expect breaking changes. Read more MCP home →

tmux through MCP

Replay Hover a call to preview the tmux state after it. Use its pin button to hold it. With the replay focused, the arrow keys, Home and End step through the calls.

tmux before the first call.

tmux window of 1 pane
%0 sh
[checks] 0:sh*

tmux after create_session.

tmux window of 2 panes
%0 sh
%1 sh
[checks] 0:sh*

tmux after split_window.

tmux window of 2 panes
%0 sh
%1 sh
[checks] 0:sh*

tmux after list_windows: unchanged, the call only reads.

tmux window of 2 panes
%0 sh
$ pytest -q
$  (
pytest -q
..                               [100%]
2 passed in 0.01s
$
%1 sh
[checks] 0:sh*

tmux after run_command.

tmux window of 2 panes
%0 sh
$ pytest -q
$  (
pytest -q
..                               [100%]
2 passed in 0.01s
$
%1 sh
$ cat checks.log
$  (
cat checks.log
2026-01-01 checks started
2026-01-01 checks finished
$
[checks] 0:sh*

tmux after run_command.

No sessions

tmux after kill_session.

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.

AgentCreate the session.

create_session Execute {"session_name":"checks"}
Result
{
"session_id": "$0",
"session_name": "checks",
"window_count": 1,
"session_attached": "0",
"session_created": "1795059312",
"active_pane_id": "%0"
}

AgentSplit the pane the create result returned (%0) in two.

split_window Execute {"pane_id":"%0","direction":"right"}
Result
{
"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.

list_windows Inspect {"session_name":"checks"}
Result
{
"result": [
{
"window_id": "@0",
"window_name": "sh",
"window_index": "0",
"session_id": "$0",
"session_name": "checks",
"pane_count": 2,
"window_layout": "8205,80x24,0,0{40x24,0,0,0,39x24,41,0,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).

run_command Execute {"pane_id":"%0","command":"pytest -q"}
Result
{
"pane_id": "%0",
"exit_status": 0,
"timed_out": false,
"elapsed_seconds": 0.8076037850041757,
"output": [
"$ (",
"pytest -q",
".. [100%]",
"2 passed in 0.01s",
"… 1 more"
],
"output_truncated": false,
"output_truncated_lines": 0,
"effective_timeout": 30
}

AgentShow the log in the new pane the split returned (%1).

run_command Execute {"pane_id":"%1","command":"cat checks.log"}
Result
{
"pane_id": "%1",
"exit_status": 0,
"timed_out": false,
"elapsed_seconds": 0.029483657999662682,
"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.

kill_session Teardown {"session_name":"checks"}
Result
{
"result": "Session killed: checks"
}
Agent

pytest printed 2 passed and checks.log ends with checks finished. I removed the checks session.

1/6

Install libtmux-mcp

Choose your client and configuration scope, then run the command or paste the configuration.

Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
claude_desktop_config.json
claude_desktop_config.json
claude_desktop_config.json
claude_desktop_config.json
claude_desktop_config.json
claude_desktop_config.json
claude_desktop_config.json
claude_desktop_config.json
claude_desktop_config.json
Terminal
Terminal
Terminal
.codex/config.toml
.codex/config.toml
.codex/config.toml
Terminal
Terminal
Terminal
.codex/config.toml
.codex/config.toml
.codex/config.toml
Terminal
Terminal
Terminal
.codex/config.toml
.codex/config.toml
.codex/config.toml
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
.cursor/mcp.json
.cursor/mcp.json
.cursor/mcp.json
~/.cursor/mcp.json
~/.cursor/mcp.json
~/.cursor/mcp.json
.cursor/mcp.json
.cursor/mcp.json
.cursor/mcp.json
~/.cursor/mcp.json
~/.cursor/mcp.json
~/.cursor/mcp.json
.cursor/mcp.json
.cursor/mcp.json
.cursor/mcp.json
~/.cursor/mcp.json
~/.cursor/mcp.json
~/.cursor/mcp.json
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
~/.gemini/config/mcp_config.json
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
Terminal
libtmux-mcp 0.1.0a22 pre-alpha PyPI
$ claude mcp add tmux -- uvx libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ claude mcp add tmux \
    -- uvx \
        --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ claude mcp add tmux -- uvx --no-config libtmux-mcp
$ claude mcp add tmux --scope user -- uvx libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ claude mcp add tmux \
    --scope user \
    -- uvx \
        --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ claude mcp add tmux --scope user -- uvx --no-config libtmux-mcp
$ claude mcp add tmux --scope project -- uvx libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ claude mcp add tmux \
    --scope project \
    -- uvx \
        --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ claude mcp add tmux --scope project -- uvx --no-config libtmux-mcp
$ claude mcp add tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux -- pipx run libtmux-mcp
$ claude mcp add tmux --scope user -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope user -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope user -- pipx run libtmux-mcp
$ claude mcp add tmux --scope project -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope project -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope project -- pipx run libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ claude mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ claude mcp add tmux --scope user -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope user -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope user -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ claude mcp add tmux --scope project -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope project -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ claude mcp add tmux --scope project -- libtmux-mcp
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"]
        }
    }
}
Cooldown ; libtmux-mcp itself stays current.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["--exclude-newer", "P7D", "--exclude-newer-package", "libtmux-mcp=2099-01-01", "libtmux-mcp"]
        }
    }
}
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"],
            "env": { "UV_NO_CONFIG": "1" }
        }
    }
}
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
$ codex mcp add tmux -- uvx libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ codex mcp add tmux \
    -- uvx \
        --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ codex mcp add tmux -- uvx --no-config libtmux-mcp
[mcp_servers.tmux]
command = "uvx"
args = ["libtmux-mcp"]
Cooldown ; libtmux-mcp itself stays current.
[mcp_servers.tmux]
command = "uvx"
args = ["--exclude-newer", "P7D", "--exclude-newer-package", "libtmux-mcp=2099-01-01", "libtmux-mcp"]
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
[mcp_servers.tmux]
command = "uvx"
args = ["libtmux-mcp"]
env = { UV_NO_CONFIG = "1" }
$ codex mcp add tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ codex mcp add tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ codex mcp add tmux -- pipx run libtmux-mcp
[mcp_servers.tmux]
command = "pipx"
args = ["run", "libtmux-mcp"]
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
[mcp_servers.tmux]
command = "pipx"
args = ["run", "libtmux-mcp"]
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
[mcp_servers.tmux]
command = "pipx"
args = ["run", "libtmux-mcp"]
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ codex mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ codex mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ codex mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
[mcp_servers.tmux]
command = "libtmux-mcp"
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
[mcp_servers.tmux]
command = "libtmux-mcp"
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
[mcp_servers.tmux]
command = "libtmux-mcp"
$ gemini mcp add --scope user tmux uvx -- libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ gemini mcp add \
    --scope user \
    tmux uvx \
    -- --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ gemini mcp add --scope user tmux uvx -- --no-config libtmux-mcp
$ gemini mcp add --scope project tmux uvx -- libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ gemini mcp add \
    --scope project \
    tmux uvx \
    -- --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ gemini mcp add --scope project tmux uvx -- --no-config libtmux-mcp
$ gemini mcp add --scope user tmux pipx -- run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope user tmux pipx -- run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope user tmux pipx -- run libtmux-mcp
$ gemini mcp add --scope project tmux pipx -- run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope project tmux pipx -- run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope project tmux pipx -- run libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ gemini mcp add --scope user tmux libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope user tmux libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope user tmux libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ gemini mcp add --scope project tmux libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope project tmux libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ gemini mcp add --scope project tmux libtmux-mcp
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"]
        }
    }
}
Cooldown ; libtmux-mcp itself stays current.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["--exclude-newer", "P7D", "--exclude-newer-package", "libtmux-mcp=2099-01-01", "libtmux-mcp"]
        }
    }
}
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"],
            "env": { "UV_NO_CONFIG": "1" }
        }
    }
}
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"]
        }
    }
}
Cooldown ; libtmux-mcp itself stays current.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["--exclude-newer", "P7D", "--exclude-newer-package", "libtmux-mcp=2099-01-01", "libtmux-mcp"]
        }
    }
}
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"],
            "env": { "UV_NO_CONFIG": "1" }
        }
    }
}
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
$ grok mcp add --scope user tmux -- uvx libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ grok mcp add \
    --scope user \
    tmux \
    -- uvx \
        --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ grok mcp add --scope user tmux -- uvx --no-config libtmux-mcp
$ grok mcp add --scope project tmux -- uvx libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ grok mcp add \
    --scope project \
    tmux \
    -- uvx \
        --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ grok mcp add --scope project tmux -- uvx --no-config libtmux-mcp
$ grok mcp add --scope user tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope user tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope user tmux -- pipx run libtmux-mcp
$ grok mcp add --scope project tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope project tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope project tmux -- pipx run libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ grok mcp add --scope user tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope user tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope user tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ grok mcp add --scope project tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope project tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ grok mcp add --scope project tmux -- libtmux-mcp
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"]
        }
    }
}
Cooldown ; libtmux-mcp itself stays current.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["--exclude-newer", "P7D", "--exclude-newer-package", "libtmux-mcp=2099-01-01", "libtmux-mcp"]
        }
    }
}
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
{
    "mcpServers": {
        "tmux": {
            "command": "uvx",
            "args": ["libtmux-mcp"],
            "env": { "UV_NO_CONFIG": "1" }
        }
    }
}
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "pipx",
            "args": ["run", "libtmux-mcp"]
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
{
    "mcpServers": {
        "tmux": {
            "command": "libtmux-mcp"
        }
    }
}
$ opencode mcp add tmux -- uvx libtmux-mcp
Cooldown ; libtmux-mcp itself stays current.
$ opencode mcp add tmux \
    -- uvx \
        --exclude-newer P7D \
        --exclude-newer-package libtmux-mcp=2099-01-01 \
        libtmux-mcp
Cooldown Bypasses a cooldown set in your uvx configuration, for this install only.
$ opencode mcp add tmux -- uvx --no-config libtmux-mcp
$ opencode mcp add tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ opencode mcp add tmux -- pipx run libtmux-mcp
Cooldown pipx has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ opencode mcp add tmux -- pipx run libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
$ opencode mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ opencode mcp add tmux -- libtmux-mcp
First
$ pip install --user --upgrade libtmux libtmux-mcp
Cooldown pip has no per-package cooldown override, so this snippet runs without cooldown enforcement.
$ opencode mcp add tmux -- libtmux-mcp

Writes ~/.claude.json (this project).

With uvx installed.

Writes ~/.claude.json (this project).

With uvx installed.

Writes ~/.claude.json (this project).

With uvx installed.

Writes ~/.claude.json (all projects).

With uvx installed.

Writes ~/.claude.json (all projects).

With uvx installed.

Writes ~/.claude.json (all projects).

With uvx installed.

Writes .mcp.json (in repo, version-controlled).

With uvx installed.

Writes .mcp.json (in repo, version-controlled).

With uvx installed.

Writes .mcp.json (in repo, version-controlled).

With uvx installed.

Writes ~/.claude.json (this project).

With pipx installed.

Writes ~/.claude.json (this project).

With pipx installed.

Writes ~/.claude.json (this project).

With pipx installed.

Writes ~/.claude.json (all projects).

With pipx installed.

Writes ~/.claude.json (all projects).

With pipx installed.

Writes ~/.claude.json (all projects).

With pipx installed.

Writes .mcp.json (in repo, version-controlled).

With pipx installed.

Writes .mcp.json (in repo, version-controlled).

With pipx installed.

Writes .mcp.json (in repo, version-controlled).

With pipx installed.

Writes ~/.claude.json (this project).

Writes ~/.claude.json (this project).

Writes ~/.claude.json (this project).

Writes ~/.claude.json (all projects).

Writes ~/.claude.json (all projects).

Writes ~/.claude.json (all projects).

Writes .mcp.json (in repo, version-controlled).

Writes .mcp.json (in repo, version-controlled).

Writes .mcp.json (in repo, version-controlled).

With uvx installed.

With uvx installed.

With uvx installed.

With pipx installed.

With pipx installed.

With pipx installed.

Writes ~/.codex/config.toml.

With uvx installed.

Writes ~/.codex/config.toml.

With uvx installed.

Writes ~/.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.

With uvx installed.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

With uvx installed.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

With uvx installed.

Writes ~/.codex/config.toml.

With pipx installed.

Writes ~/.codex/config.toml.

With pipx installed.

Writes ~/.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.

With pipx installed.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

With pipx installed.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

With pipx installed.

Writes ~/.codex/config.toml.

Writes ~/.codex/config.toml.

Writes ~/.codex/config.toml.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

Codex's CLI doesn't support project scope yet — paste this into .codex/config.toml at the repo root.

Writes ~/.gemini/settings.json.

With uvx installed.

Writes ~/.gemini/settings.json.

With uvx installed.

Writes ~/.gemini/settings.json.

With uvx installed.

Writes .gemini/settings.json (in repo).

With uvx installed.

Writes .gemini/settings.json (in repo).

With uvx installed.

Writes .gemini/settings.json (in repo).

With uvx installed.

Writes ~/.gemini/settings.json.

With pipx installed.

Writes ~/.gemini/settings.json.

With pipx installed.

Writes ~/.gemini/settings.json.

With pipx installed.

Writes .gemini/settings.json (in repo).

With pipx installed.

Writes .gemini/settings.json (in repo).

With pipx installed.

Writes .gemini/settings.json (in repo).

With pipx installed.

Writes ~/.gemini/settings.json.

Writes ~/.gemini/settings.json.

Writes ~/.gemini/settings.json.

Writes .gemini/settings.json (in repo).

Writes .gemini/settings.json (in repo).

Writes .gemini/settings.json (in repo).

With uvx installed.

With uvx installed.

With uvx installed.

With uvx installed.

With uvx installed.

With uvx installed.

With pipx installed.

With pipx installed.

With pipx installed.

With pipx installed.

With pipx installed.

With pipx installed.

Writes ~/.grok/config.toml.

With uvx installed.

Writes ~/.grok/config.toml.

With uvx installed.

Writes ~/.grok/config.toml.

With uvx installed.

Writes ./.grok/config.toml (in repo).

With uvx installed.

Writes ./.grok/config.toml (in repo).

With uvx installed.

Writes ./.grok/config.toml (in repo).

With uvx installed.

Writes ~/.grok/config.toml.

With pipx installed.

Writes ~/.grok/config.toml.

With pipx installed.

Writes ~/.grok/config.toml.

With pipx installed.

Writes ./.grok/config.toml (in repo).

With pipx installed.

Writes ./.grok/config.toml (in repo).

With pipx installed.

Writes ./.grok/config.toml (in repo).

With pipx installed.

Writes ~/.grok/config.toml.

Writes ~/.grok/config.toml.

Writes ~/.grok/config.toml.

Writes ./.grok/config.toml (in repo).

Writes ./.grok/config.toml (in repo).

Writes ./.grok/config.toml (in repo).

With uvx installed.

With uvx installed.

With uvx installed.

With pipx installed.

With pipx installed.

With pipx installed.

Writes ~/.config/opencode/opencode.jsonc.

With uvx installed.

Writes ~/.config/opencode/opencode.jsonc.

With uvx installed.

Writes ~/.config/opencode/opencode.jsonc.

With uvx installed.

Writes ~/.config/opencode/opencode.jsonc.

With pipx installed.

Writes ~/.config/opencode/opencode.jsonc.

With pipx installed.

Writes ~/.config/opencode/opencode.jsonc.

With pipx installed.

Writes ~/.config/opencode/opencode.jsonc.

Writes ~/.config/opencode/opencode.jsonc.

Writes ~/.config/opencode/opencode.jsonc.

Workspace Manager

Load a workspace file 1.x Released; the API may change. Read more Workspace Manager home →

Main-horizontal layout

The main-horizontal layout gives the first pane the top of the window and splits the rest below it.

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"
{
"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\""
}
]
}
]
}
]
}
Window 0, test: 3 panes, main-horizontal❯ vim❯ echo "hey"❯ echo "moo"
layout main-horizontal

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).

Short-hand panes

A pane can be one command written as a string, and a command list can be one string.

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
{
"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"
]
}
]
}
Window 0, focused window: 3 panes, main-horizontal❯ cd ~❯ cd /usr❯ cd ~❯ echo "moo"❯ top
layout main-horizontal
Window 1, window 2: 3 panes, even-vertical❯ top❯ echo "hey"❯ echo "moo"
no layout set
Window 2, window 3: 3 panes, even-vertical❯ cd /
no layout set

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).

Two panes

A window of two panes.

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
{
"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"
}
]
}
]
}
]
}
Window 0, editor: 2 panes, main-vertical❯ vim❯ echo "hey"
layout main-vertical
Window 1, logging: 1 pane, even-vertical❯ tail | echo 'hi'
no layout set
Window 2, test: 1 pane, even-vertical❯ htop
no layout set

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).

Setup before each pane

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"
]
}
]
}
]
}
Window 0, editor: 3 panes, even-vertical❯ vim❯ :Ex❯ cd /usr
no layout set
Window 1, logging: 2 panes, even-vertical❯ top❯ emacs
no layout set

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

environment sets variables for a session, a window or a 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
# 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"
}
}
]
}
]
}
Window 0, no_overrides: 1 pane, even-vertical
no layout set
Window 1, window_overrides: 1 pane, even-vertical
no layout set
Window 2, pane_overrides: 1 pane, even-vertical
no layout set
Window 3, both_overrides: 2 panes, even-vertical
no layout set
Window 4, both_overrides_on_first_pane: 1 pane, even-vertical
no layout set

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

start_directory chooses where a session, a window or a pane starts.

session_name: sample workspace
windows:
- panes:
- start_directory: /usr
- start_directory: /etc
{
"session_name": "sample workspace",
"windows": [
{
"panes": [
{
"start_directory": "/usr"
},
{
"start_directory": "/etc"
}
]
}
]
}
Window 0: 2 panes, even-vertical
no layout set

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).

Blank panes

An empty entry, null, pane or blank opens a pane with no command.

session_name: Blank pane test
windows:
# 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"
}
]
}
]
}
Window 0, Blank pane test: 3 panes, even-vertical
no layout set
Window 1, More blank panes: 3 panes, even-vertical
no layout set
Window 2, Empty string (return): 3 panes, even-vertical
no layout set
Window 3, Blank with options: 2 panes, even-vertical
no layout set

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).

Install tmuxp

The workspace package is separate from the core library.

Terminal
Terminal
Terminal
tmuxp 1.76.0 1.x PyPI
$ uv tool install tmuxp
Then
$ tmuxp load ./workspace.yaml
$ uvx tmuxp --help
$ pipx install tmuxp
Then
$ tmuxp load ./workspace.yaml

Installs tmuxp in an isolated Python environment. Run tmuxp load ./workspace.yaml.

Runs without a permanent installation. Replace --help with load ./workspace.yaml to load a workspace.

Installs the tmuxp command in an isolated Python environment.

Build the workspace from a program
src/tmuxp/workspace/builder/classic.pyExcerpt · lines 123–157
>>> 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. This program is tested on every change.

Packages and integrations

API references

Esc
Search in

Type to search.

Reference previewOpen reference