Expand description
Other programs and web pages inside an intuiTUIve app.
terminalruns any program in a pane of the app: a shell,htop, an editor, a terminal browser. Keys, the mouse, pastes and resizes go to the program; its screen is followed by rs-rich-record’s VT emulator (vt100, with rich’s character widths) and drawn in the pane, with scrollback; its exit is a signal and a callback.web_viewshows a web page in a pane, with an address bar, and back, forward, reload, the address and the loading state as signals.
Each sits on a trait, as intuiTUIve’s terminals sit on Backend: what
runs behind it can be swapped for another implementation, including one
the app writes itself.
PtyHoststarts a program and carries its bytes and size.LocalPtyruns one on this machine (a PTY on Unix, ConPTY on Windows);ReplayHostplays bytes back, for tests. An SSH session is a third, passed toterminal_with.WebEngineopens pages, takes input and hands back frames, of cells or of pixels.ProgramEngine(the default) runs a terminal browser (Carbonyl, Browsh, Chawan, w3m) in a pane;ChromeEngine(featurechrome) drives a headless Chrome or Chromium the user installed, over the DevTools protocol;BrowshEngine(featurebrowsh) reads pages as text from Browsh’s HTTP server. Pixel frames are drawn as coloured half blocks.
No browser ships with this crate, and none is downloaded: each is a program the user chooses and installs.
use intuituive::prelude::*;
use rich_embed::{terminal, web_view_with, ProgramEngine};
fn main() -> std::io::Result<()> {
App::new(|| {
let page = web_view_with(ProgramEngine::new("w3m"), "https://example.com");
row([
terminal("bash").on_exit(|_, cx| cx.quit()).node().panel("shell"),
page.node().panel("web"),
])
})
.run()
}The panes need a running app: like signal,
terminal and web_view are called inside App::new’s closure or
a node’s.
Modules§
- keys
- Keys, the mouse and pastes as the bytes an xterm-compatible terminal sends a program.
Structs§
- Command
- A program and its arguments, environment and directory, for
LocalPty. A string is a program name; an array or a vector is the program and its arguments. - Exit
Status - How a program ended.
- Local
Pty - A program on this machine, on a PTY (ConPTY on Windows), through portable-pty as rs-rich-record’s tapes run theirs.
- Page
State - Where the page is and what it is doing.
- Pixels
- A frame of pixels:
widthxheight, three bytes (red, green, blue) per pixel, rows top to bottom. - Program
Engine - A terminal browser, named by the app, run in a terminal pane: its screen is the page. Nothing of ours ships with it, and nothing is downloaded; install the browser you want.
- Replay
Handle - Feeds a
ReplayHostand reads back what it was sent. - Replay
Host - A host that plays bytes back instead of running anything: for tests,
demos and recordings. What it plays is given up front
(
output,exit) or later through aReplayHandle, which also sees what the pane sent it. - Terminal
Pane - A terminal pane being built:
terminalorterminal_with, thennode(or.into()) to place it. - WebHandle
- The page’s state as signals, and what the app can ask of it.
Copy, like a signal: move it into handlers. - WebView
- A web view being built:
web_vieworweb_view_with, thennodeto place it;handlefor its signals and navigation.
Enums§
Constants§
- BROWSER_
VARIABLE - The environment variable
ProgramEngine::detectreads first: a browser and its arguments, separated by spaces ("w3m -o confirm_qq=false"). - DEFAULT_
SCROLLBACK - Rows a pane keeps that scrolled off its top, unless told otherwise.
- KNOWN_
BROWSERS - Terminal browsers
ProgramEngine::detectlooks for onPATH, in order: (program, arguments before the address). Carbonyl, a Chromium, takes--as the end of its options.
Traits§
- PtyHost
- Starts a program and carries its bytes and its size: what a terminal pane talks to. Every method is called on the app’s thread.
- WebEngine
- A browser behind a
web_view: opens pages, takes input, and hands back frames. Every method is called on the app’s thread; work that takes time happens on the engine’s own threads, which call theNotifywhen there is a new frame or a new state.
Functions§
- half_
blocks pixelsscaled tocolumnsxrowscells of half blocks.- terminal
- A pane running
commandon this machine through aLocalPty: a program name, or an array of the program and its arguments. - terminal_
with - A pane over any
PtyHost: an SSH session, a container, aReplayHostin a test. - web_
view - A web page at
url, shown by a terminal browser named by the environment or found onPATH(ProgramEngine::detect). Name one withweb_view_withandProgramEngine::new. - web_
view_ with - A web page at
url, shown byengine.
Type Aliases§
- Notify
- Called by a host, from any thread, when output arrives or the program exits. It only schedules work: the pane reads the host on the app’s thread.