Files
ghostty-rs/crates/ghostty-config/src/lib.rs
T
ddidderr 75bf604375 feat(lib): port libghostty, Ghostty's embedded C API
Ports apprt/embedded.zig, main_c.zig and config/CApi.zig + c_get.zig as
crates/ghostty-lib (cdylib/staticlib/rlib `libghostty`), exporting every
function of the unchanged include/ghostty.h - the ABI Ghostty's Swift
macOS/iOS app links against. The embedded runtime implements the
runtime traits over the host's C callbacks, so the real core drives it.

- ghostty-core selects the renderer per target: Metal on Apple (surface
  NSView/UIView via RtSurface::platform_view), OpenGL elsewhere.
- ghostty_config_get follows Zig's c_get rules via a CValue type (143
  supported keys, checked against the Zig field types).
- The inspector C API is complete; its Metal backend replaces ImGui's
  Metal renderer and has not run.

Verification: generated C ABI probe (sizeof/alignof/offsetof of every
struct/union, 755 enum values, every function linked, nm exports, headers
byte-identical to upstream); a C host on Linux covering init, CLI
actions, config, app, keys, focus and color scheme; an opt-in
test-platform feature creating real surfaces on Linux with headless EGL
and a pty (13 tests). Apple targets are clippy-clean but not run; the
Swift app has not been built against it.

Test Plan:
- cargo test -p ghostty-lib (and --features test-platform)
- cargo clippy --target aarch64-apple-darwin -p ghostty-lib (cross env
  in docs/rewrite/notes/macos-M1.md)
2026-10-12 06:38:33 +02:00

50 lines
1.1 KiB
Rust

//! ghostty-config: configuration parsing, loading and formatting
//! (ZIG/src/config/*, cli/args.zig, cli/CommaSplitter.zig,
//! cli/diagnostics.zig). See docs/rewrite/ARCHITECTURE.md.
#![allow(
clippy::wildcard_imports,
clippy::should_implement_trait,
clippy::float_cmp,
clippy::collapsible_if,
clippy::redundant_closure_for_method_calls,
clippy::single_match_else,
clippy::manual_let_else
)]
// Generic CLI parsing infrastructure.
pub mod c_value;
pub mod cli_args;
pub mod comma_splitter;
pub mod diagnostics;
pub mod macros;
// Config support modules.
pub mod clipboard_codepoint_map;
pub mod command;
pub mod conditional;
pub mod edit;
pub mod error_list;
pub mod file_load;
pub mod formatter;
pub mod io;
pub mod key;
pub mod path;
pub mod repeatable_string_map;
pub mod string;
pub mod theme;
pub mod url;
// Types that were nested in Config.zig.
pub mod font_types;
pub mod input_fields;
pub mod keybinds;
pub mod metric_modifier;
pub mod types_a;
pub mod types_b;
// The Config struct itself.
pub mod config;
pub mod file_formatter;
pub mod keys;