feat(apprt-gtk): port the GTK4/libadwaita app runtime

Ports ZIG/src/apprt/gtk into ghostty-apprt-gtk: every GObject class
(application, window, tab, split tree, surface + scrolled window,
child-exited banner, search/key-state/resize overlays, command palette,
global shortcuts, all dialogs, config wrapper) as glib subclasses with
the same GType names, properties, signals and template children; GDK
key translation; X11 and Wayland window-protocol helpers (blur, CSD,
quick terminal via gtk4-layer-shell); single-instance D-Bus IPC;
gsettings; cgroup scope creation.

build.rs compiles Ghostty's blueprints with blueprint-compiler and
bundles UI, CSS and icons into a gresource, as Ghostty's build does.

The core is not ported yet, so the crate defines the boundary it needs
in src/core.rs (CoreApp, CoreSurface, RtApp, RtSurface, Waker); the
spec is in docs/rewrite/notes/ghostty-apprt-gtk.md. ghostty-core will
implement these traits (the crate no longer depends on core to avoid a
cycle). examples/demo.rs runs the app with a dummy core that clears the
GLArea; it launches on Wayland without GTK criticals.

Stubs/open items: toggle_visibility, float_window, secure_input and
close_all_windows return false; inspector is a no-op; X11/Wayland
protocol code is untested against real compositors; gtk4-rs doesn't
expose the GLArea framebuffer id, so the renderer must query it.

Also registers ghostty-apprt and ghostty-cli in workspace.dependencies.

Test Plan:
- cargo test -p ghostty-apprt-gtk (36 tests)
- DEMO_QUIT_AFTER_MS=3000 cargo run -p ghostty-apprt-gtk --example demo
This commit is contained in:
ddidderr committed 2026-10-11 22:57:15 +02:00
1 parent 72434a1255
commit 88cc13871c
80 files changed
+17271 -4

No files matched your search

@@ -0,0 +1,63 @@
//! Port of apprt/gtk/winproto/noop.zig: used when neither X11 nor Wayland is
//! detected.
use std::rc::Rc;
use gtk::gdk;
use super::{Result, WindowHost};
use ghostty_input::Mods;
#[derive(Debug, Default, Clone, Copy)]
pub struct App;
impl App {
pub fn event_mods(&self, _: Option<&gdk::Device>, _: gdk::ModifierType) -> Option<Mods> {
None
}
pub fn supports_quick_terminal(&self) -> bool {
false
}
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
pub fn init_quick_terminal(&mut self, _: &gtk::Window) -> Result<()> {
Ok(())
}
}
#[derive(Debug, Default)]
pub struct Window;
impl Window {
#[allow(clippy::unnecessary_wraps)]
pub fn init(_: &App, _: Rc<dyn WindowHost>) -> Result<Window> {
Ok(Window)
}
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
pub fn resize_event(&mut self) -> Result<()> {
Ok(())
}
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
pub fn sync_appearance(&mut self) -> Result<()> {
Ok(())
}
/// Always true: this should be the actual present state of the window.
#[allow(clippy::unused_self)]
pub fn client_side_decoration_enabled(&self) -> bool {
true
}
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
pub fn add_subprocess_env(&mut self, _: &mut Vec<(String, String)>) -> Result<()> {
Ok(())
}
#[allow(clippy::unused_self, clippy::unnecessary_wraps)]
pub fn set_urgent(&mut self, _: bool) -> Result<()> {
Ok(())
}
}