feat(macos): foundation of the macOS app ported from Swift to Rust

Phase 9, MA1: crates/ghostty-macos (AppKit via objc2; empty stub on
non-Apple targets) ports the foundation of Ghostty 1.3.1's Swift macOS
app (ghostty/macos): main, AppDelegate (+Ghostty) with lifecycle, dock
menu, open-file, notifications, shortcut sync and quit/reopen paths;
MainMenu.xib as generated menu tables built into NSMenus; the
Ghostty.App/Config/Surface wrappers driving libghostty in-process via
ghostty-lib; the generic helpers; scripts/macos-bundle.sh to assemble
Ghostty.app (dry-run on Linux). Feature areas are stubbed for MA2-MA5.
Design and type mapping: docs/rewrite/notes/macos-app-design.md
(App Intents is a Swift-only framework and cannot be ported).

Compile-checked only (no macOS here): just check-macos passes for
aarch64/x86_64-apple-darwin with -D warnings; 125 platform-independent
tests run on Linux.

Test Plan:
- just check-macos
- cargo test -p ghostty-macos
This commit is contained in:
ddidderr committed 2026-10-12 19:25:44 +02:00
1 parent fb79cc8d5c
commit 0137168c66
112 files changed
+18438 -2

No files matched your search

@@ -0,0 +1,68 @@
//! `Helpers/Extensions/*`: one module per Swift file. A Swift `extension X`
//! becomes an extension trait `XExt` implemented for the objc2 type (or free
//! functions for value types). Pure logic is in the platform independent
//! modules; the AppKit traits are `cfg(target_vendor = "apple")`.
//!
//! Unportable (SwiftUI only): `View+Extension.swift`, `Transferable+Extension.swift`.
//! `UUID+Extension` (CFUUID) lives in [`uuid`]; `KeyboardShortcut+Extension`
//! is `helpers::keyboard_shortcut`.
// Platform independent.
pub mod array;
pub mod double;
pub mod duration;
pub mod event_modifiers;
pub mod file_handle;
pub mod ns_screen_logic;
pub mod ns_window_logic;
pub mod object_identifier;
pub mod optional;
pub mod os_color;
pub mod string;
// AppKit.
#[cfg(target_vendor = "apple")]
pub mod ns_appearance;
#[cfg(target_vendor = "apple")]
pub mod ns_application;
#[cfg(target_vendor = "apple")]
pub mod ns_color;
#[cfg(target_vendor = "apple")]
pub mod ns_image;
#[cfg(target_vendor = "apple")]
pub mod ns_menu;
#[cfg(target_vendor = "apple")]
pub mod ns_menu_item;
#[cfg(target_vendor = "apple")]
pub mod ns_notification;
#[cfg(target_vendor = "apple")]
pub mod ns_pasteboard;
#[cfg(target_vendor = "apple")]
pub mod ns_screen;
#[cfg(target_vendor = "apple")]
pub mod ns_view;
#[cfg(target_vendor = "apple")]
pub mod ns_window;
#[cfg(target_vendor = "apple")]
pub mod ns_workspace;
#[cfg(target_vendor = "apple")]
pub mod undo_manager;
#[cfg(target_vendor = "apple")]
pub mod user_defaults;
#[cfg(target_vendor = "apple")]
pub mod uuid;
/// `#available(macOS N, *)`: true if the running OS is at least `major`.
#[cfg(target_vendor = "apple")]
#[must_use]
pub fn macos_at_least(major: isize) -> bool {
use objc2_foundation::{NSOperatingSystemVersion, NSProcessInfo};
NSProcessInfo::processInfo().isOperatingSystemAtLeastVersion(NSOperatingSystemVersion {
majorVersion: major,
minorVersion: 0,
patchVersion: 0,
})
}
#[cfg(target_vendor = "apple")]
pub mod uti;