Core LibraryGuides

Choose documentation 3

latest

Current version

latest
English

Prerelease This site documents an alpha of libtmux. Its structure, URLs and APIs are subject to change.

Getting started

LibTmux separates remote operations from captured data. Create an owned daemon for a script, or explicitly select a borrowed endpoint. Remote functions yield on I/O and work in ordinary Julia Tasks.

This manual follows v0.1.0-alpha.1, an unregistered source release. Start with Install, then return here for an owned-server program. Product compatibility and the MCP/workspace applications remain under verification; see Compatibility.

The following source is the executable examples/owned_capture.jl program. It creates a session, captures the initial screen and asserts daemon cleanup.

owned_capture.jl
using LibTmux
function main()
endpoint = Ref{Server}()
result = with_server(; tmux=get(ENV, "LIBTMUX_TEST_TMUX", "tmux")) do server
endpoint[] = server
new_session(server; name="example", command=["/bin/cat"])
snap = snapshot(server)
pane = only(panes(snap))
screen = capture_pane(server, pane.ref)
@assert isempty(strip(screen))
@assert only(sessions(snap)).name == "example"
println("Captured ", string(pane.id), ": ", ncodeunits(screen), " screen bytes")
(; snap, screen)
end
@assert !ispath(dirname(endpoint[].socket_path))
@assert length(panes(result.snap)) == 1
result
end
main()

Use Server for a borrowed endpoint. Neither construction nor local snapshot reads contact tmux. from_env is the explicit opt-in to ambient server selection. with_server owns its daemon; ordinary server values do not.

Next, read Captured queries for filtering and shared windows, or Ownership and I/O for effects, cancellation and control.

Esc

Type to search.

Reference preview Open reference