cockpit

Crates.iocockpit
lib.rscockpit
version0.2.2
created_at2025-12-24 20:38:38.377218+00
updated_at2025-12-25 16:41:25.400509+00
descriptionTerminal multiplexer library for Ratatui applications
homepage
repositoryhttps://github.com/centy-io/cockpit
max_upload_size
id2003824
size474,796
Ofek Gabay (tupe12334)

documentation

README

Cockpit

A terminal multiplexer library for Ratatui applications.

Cockpit enables running multiple OS processes in split panes with crash isolation. Each pane runs in its own PTY (pseudo-terminal), so if one process crashes, the others continue running unaffected.

Features

  • PTY Management: Spawn processes in pseudo-terminals using portable-pty
  • Terminal Emulation: Full VT100/ANSI terminal emulation via vt100
  • Split Layouts: Horizontal and vertical pane splits
  • Crash Isolation: Each process runs independently
  • Ratatui Integration: Widgets for rendering panes
  • Mouse Support: Click to focus panes

Installation

Add to your Cargo.toml:

[dependencies]
cockpit = "0.1"

Quick Start

use cockpit::{PaneManager, SpawnConfig, PaneSize, Layout};

#[tokio::main]
async fn main() -> cockpit::Result<()> {
    // Create a pane manager
    let mut manager = PaneManager::new();

    // Spawn two panes
    let size = PaneSize::new(24, 80);
    let pane1 = manager.spawn(SpawnConfig::new(size))?;
    let pane2 = manager.spawn(SpawnConfig::new(size))?;

    // Set up a vertical split layout
    let layout = Layout::vsplit_equal(
        Layout::single(pane1.id()),
        Layout::single(pane2.id()),
    );
    manager.set_layout(layout);

    // Send input to the focused pane
    manager.send_input(b"echo hello\r").await?;

    Ok(())
}

Example

Run the interactive example:

cargo run --example basic

Controls:

  • Ctrl+Q: Quit
  • Ctrl+N: Focus next pane
  • Mouse click: Focus pane under cursor

License

Licensed under either of:

at your option.

Commit count: 0

cargo fmt