zterm

Control actions

What zterm perform <action> does, and what a program on the control socket can send. Each row shows the JSON the socket takes. zterm perform builds that same message from the name.

A row with a field in it takes an argument: zterm perform select_pane 2. The four actions that start a process (new_tab, new_window, split_right, split_down) also take --cwd <dir> and a trailing -- <command>.... A relative --cwd is taken from the folder you run zterm perform in, except for a pane on another machine, where only a full path works. A --cwd that names no folder on the machine that opens the pane is refused with no such directory, and nothing opens. The two splits take --ratio <share> as well, the new pane's share of the pane it divides, from 0.05 to 0.95. On the socket that is the ratio field, a number: {"action":"split_down","ratio":0.25}. Each of the four also takes --web <dir> [entry], a page instead of a process: the directory is served to the pane under zterm-web://<id>/ and it opens entry, index.html when absent. On the socket that is the web field: {"action":"split_down","web":{"dir":"/srv/report"}}. A pane shows a page or runs a process, so --web beside --cwd or -- is refused.

join_pane and join_pane_down take an optional pane to move, zterm perform join_pane build, which is the pane field on the socket. join_pane also takes --below <pane> or --right-of <pane>, which are the below and right_of fields. swap_pane takes an optional pane to trade places with, which is its pane field. Every one of these is a pane address: a workspace:// URI, a pane id or a pane's name.

tile_columns, tile_rows, tile_grid and tile_main rebuild the target's tab from its panes in reading order, and take no argument. tile_main puts the target on the left at six tenths of the width and stacks the rest beside it.

close_tab takes a pane address or a tab id, as zterm ls reports it in tab_id, and closes that tab.

reload_pane reloads a web pane's page at the address it shows, and opens a new web view there when the page's process has died or stopped answering. reload_panel opens the window's panel page again in a new view. It is not in the palette: hiding the panel and showing it again does the same.

go_back and go_forward move a web pane's page one step through its history, as a browser's Back and Forward do; a page with nothing that way stays where it is. open_in_browser opens the page in your default browser at the address the pane shows. A page served from an extension's folder has no address a browser can open, and the action fails with a message saying so. The pane's title bar has a button for each of these and for reload_pane.

reconnect_pane makes a pane on another machine whose link is down try that machine now, instead of waiting out the pause between tries. It fails for a pane on this machine and for one whose machine says it is gone. A pane whose link is down has a button for it on its title bar, and the palette's Pane group offers Reconnect Now while the focused pane's link is down.

attach and spawn_remote reach a pane on another machine in your mesh. attach takes the pane's id, as zterm ls lists it on a row with a node: zterm perform attach <pane_id> opens it in a new tab here. spawn_remote opens a pane on another machine: zterm perform spawn_remote --node <node> [--name <name>] [--dir <dir>] [--env NAME=VALUE]... -- <command>.... --node is the machine's label, as node shows it, or its id, and --dir is a directory on that machine. On the socket the variables are the env field, a list of name and value pairs: {"action":"spawn_remote","node":"agent-box","command":["make"],"env":[["CI","1"]]}. It answers with the new pane as zterm ls lists it. close_pane given the id of a pane on another machine asks that machine to close it, write given one types into it there, and read_text given one answers with its screen as that machine reads it. A write to a pane on another machine takes --submit and --when-idle. The machine that hosts the pane holds the write until nobody there is typing into it. A machine running zterm 0.9.63 or older refuses --when-idle.

write never types into a password prompt. While the program in the pane reads input it does not show, as sudo, ssh and passwd do, a write answers input_concealed and exits 7, and nothing is typed. With --when-idle it waits for the prompt to end instead, and if the wait runs out the answer is idle_timeout with hidden_input. Your own typing and pasting are never held. See Password prompts in the integration guide for what this cannot see.

Action Message
new_tab {"action":"new_tab"}
close_tab {"action":"close_tab"}
next_tab {"action":"next_tab"}
prev_tab {"action":"prev_tab"}
select_pane {"action":"select_pane","index":1}
move_tab_left {"action":"move_tab_left"}
move_tab_right {"action":"move_tab_right"}
move_tab_to_next_window {"action":"move_tab_to_next_window"}
rename_pane {"action":"rename_pane","name":"build"}
set_tab_color {"action":"set_tab_color","color":"teal"}
set_tab_squad {"action":"set_tab_squad","squad":"render"}
set_pane_status {"action":"set_pane_status","state":"blocked","label":"waiting on approval","from":"herdr"}
write {"action":"write","bytes":"build"}
split_right {"action":"split_right"}
split_down {"action":"split_down"}
retype_pane {"action":"retype_pane"}
read_console {"action":"read_console"}
screenshot_pane {"action":"screenshot_pane","path":""}
reload_pane {"action":"reload_pane"}
go_back {"action":"go_back"}
go_forward {"action":"go_forward"}
open_in_browser {"action":"open_in_browser"}
reconnect_pane {"action":"reconnect_pane"}
open_dashboard {"action":"open_dashboard"}
close_pane {"action":"close_pane"}
focus_next_pane {"action":"focus_next_pane"}
focus_prev_pane {"action":"focus_prev_pane"}
focus_last_viewed_pane {"action":"focus_last_viewed_pane"}
focus_left {"action":"focus_left"}
focus_right {"action":"focus_right"}
focus_up {"action":"focus_up"}
focus_down {"action":"focus_down"}
resize_pane_left {"action":"resize_pane_left"}
resize_pane_right {"action":"resize_pane_right"}
resize_pane_up {"action":"resize_pane_up"}
resize_pane_down {"action":"resize_pane_down"}
zoom_pane {"action":"zoom_pane"}
equalize_panes {"action":"equalize_panes"}
join_pane {"action":"join_pane"}
join_pane_down {"action":"join_pane_down"}
break_pane {"action":"break_pane"}
swap_pane {"action":"swap_pane"}
tile_columns {"action":"tile_columns"}
tile_rows {"action":"tile_rows"}
tile_grid {"action":"tile_grid"}
tile_main {"action":"tile_main"}
pick_pane {"action":"pick_pane"}
pick_link {"action":"pick_link"}
go_to_pane {"action":"go_to_pane"}
manage_grants {"action":"manage_grants"}
settings {"action":"settings"}
reload_settings {"action":"reload_settings"}
check_for_update {"action":"check_for_update"}
panel_full {"action":"panel_full"}
panel_minimal {"action":"panel_minimal"}
panel_hidden {"action":"panel_hidden"}
cycle_panel {"action":"cycle_panel"}
reload_panel {"action":"reload_panel"}
replay_wizard {"action":"replay_wizard"}
spawn {"action":"spawn"}
open_profile {"action":"open_profile","name":"zsh"}
attach {"action":"attach","pane":"01JZ8W0000000000000000000C"}
spawn_remote {"action":"spawn_remote","node":"agent-box","command":["claude"]}
begin_rename_pane {"action":"begin_rename_pane"}
new_window {"action":"new_window"}
close_window {"action":"close_window"}
next_window {"action":"next_window"}
prev_window {"action":"prev_window"}
select_window {"action":"select_window","index":1}
copy {"action":"copy"}
paste {"action":"paste"}
select_all {"action":"select_all"}
selection_mode {"action":"selection_mode"}
scroll_line_up {"action":"scroll_line_up"}
scroll_line_down {"action":"scroll_line_down"}
scroll_page_up {"action":"scroll_page_up"}
scroll_page_down {"action":"scroll_page_down"}
scroll_to_top {"action":"scroll_to_top"}
scroll_to_bottom {"action":"scroll_to_bottom"}
clear_scrollback {"action":"clear_scrollback"}
find {"action":"find"}
find_next {"action":"find_next"}
find_previous {"action":"find_previous"}
palette {"action":"palette"}
font_size_up {"action":"font_size_up"}
font_size_down {"action":"font_size_down"}
font_size_reset {"action":"font_size_reset"}
toggle_fullscreen {"action":"toggle_fullscreen"}
read_text {"action":"read_text"}
quit {"action":"quit"}
previous_prompt {"action":"previous_prompt"}
next_prompt {"action":"next_prompt"}
select_output {"action":"select_output"}