This is the integration step that turns the ported crates into a working
terminal: `cargo run` now opens a GTK window running the user's shell.
ghostty-core ports App.zig, Surface.zig (split into keyboard, mouse,
binding, clipboard and config submodules), surface_mouse.zig and
global.zig, and implements the runtime traits. perform_binding_action
handles every binding action.
Cross-crate integration:
- The core<->runtime traits (CoreApp, CoreSurface, RtApp, RtSurface,
Waker) move from apprt-gtk into ghostty_apprt::runtime_api so the core
stays runtime-agnostic; Scrollbar/RendererHealth stand-ins are replaced
by the real terminal/renderer types.
- termio now uses ghostty_renderer::state::{State, SharedState}; the
renderer calls kitty_update; image-storage-limit is applied at init
and on config change.
- The search thread locks the terminal through a TerminalLock trait so
it can share the render state mutex; termio's Wakeup gained a hook to
wake the renderer thread.
- apprt-gtk: GL proc addresses are resolved through libepoxy's
epoxy_glFoo pointer variables (plain glFoo symbols resolved to null),
default DPI fixed to 96, libadwaita version read without GTK init so
--version works headless.
The root binary dispatches +actions to ghostty-cli (list-fonts,
show-face and new-window are now wired) and otherwise runs the GTK app
with the real core.
Verified at runtime on Wayland and X11: shell prompt and colored output
render, child exit closes the window cleanly. Not yet verified: keyboard
and mouse input, clipboard, IME, tabs and splits (no key injection was
possible in this environment). GHOSTTY_DEBUG_SCREENSHOT=<png> dumps the
renderer's last frame for headless checks.
Test Plan:
- cargo test --workspace (2890 passed)
- cargo clippy --workspace --all-targets -- -D warnings
- GSETTINGS_BACKEND=memory GHOSTTY_RESOURCES_DIR=/usr/share/ghostty \
cargo run
50 lines
1.3 KiB
Rust
50 lines
1.3 KiB
Rust
//! ghostty-termio: see docs/rewrite/ARCHITECTURE.md for the module map.
|
|
//!
|
|
//! Linux only. Ported: `pty.zig`, `Command.zig`, the `terminfo/*` source
|
|
//! generator and everything in `termio/` (`Options`, `backend`, `message`,
|
|
//! `mailbox`, `Termio`, `Thread`, `Exec`, `stream_handler`,
|
|
//! `shell_integration`). See `docs/rewrite/notes/ghostty-termio-IO1.md` and
|
|
//! `ghostty-termio-IO2.md`.
|
|
//!
|
|
//! This crate may use limited `unsafe` (fork/exec in `command`, a few
|
|
//! async-signal-safe libc calls in `pty`); everything else is safe.
|
|
|
|
#![cfg_attr(
|
|
test,
|
|
allow(
|
|
clippy::unwrap_used,
|
|
clippy::assert_is_empty,
|
|
clippy::items_after_statements
|
|
)
|
|
)]
|
|
|
|
pub mod backend;
|
|
pub mod command;
|
|
pub mod exec;
|
|
pub mod mailbox;
|
|
pub mod message;
|
|
pub mod options;
|
|
pub mod pty;
|
|
pub mod shell_integration;
|
|
pub mod sinks;
|
|
pub mod state;
|
|
pub mod stream_handler;
|
|
pub mod terminfo;
|
|
pub mod termio;
|
|
pub mod thread;
|
|
pub mod wakeup;
|
|
|
|
pub use backend::Backend;
|
|
pub use command::Command;
|
|
pub use exec::Exec;
|
|
pub use mailbox::Mailbox;
|
|
pub use message::Message;
|
|
pub use options::Options;
|
|
pub use pty::{Pty, Winsize};
|
|
pub use sinks::{RendererMailbox, SurfaceMailbox};
|
|
pub use state::{SharedState, SharedStateExt, State, TerminalGuard};
|
|
pub use stream_handler::StreamHandler;
|
|
pub use termio::{DerivedConfig, Termio};
|
|
pub use thread::Thread;
|
|
pub use wakeup::Wakeup;
|