Files
craft-libs/crates/quit/Cargo.toml
Jake MacekandClaude Opus 5.5 ebf3f552cd craft-quit: macOS app menu whose Quit asks the app first
winit's default app menu sends Quit (Cmd+Q) straight to
-[NSApplication terminate:] and winit doesn't implement
applicationShouldTerminate:, so a Craft app quits without its
unsaved-changes prompt. The new opt-in `menu` feature adds
`install_app_menu(ctx, app_name)`, which replaces that menu with a
muda-built copy whose Quit sends ViewportCommand::Close. The app's own
close handling then runs, as for the close button, and
on_close_request quits.

muda is a macOS-only, optional dependency; no unsafe code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 20:18:18 +02:00

28 lines
1.1 KiB
TOML

[package]
name = "craft-quit"
description = "Quit a Craft app the platform's own way: on macOS through `-[NSApplication terminate:]`."
version.workspace = true
edition.workspace = true
license.workspace = true
rust-version.workspace = true
repository.workspace = true
[features]
# `on_close_request`: route an egui/eframe window close through the platform quit.
egui = ["dep:egui"]
# `install_app_menu`: a macOS app menu whose Quit (⌘Q) asks the app first, like the close button.
menu = ["egui", "dep:muda"]
[dependencies]
egui = { workspace = true, optional = true }
# Already in the apps' Cargo.lock: objc2 and objc2-app-kit through eframe, dispatch2 through its other dependencies.
[target.'cfg(target_os = "macos")'.dependencies]
dispatch2 = { version = "0.3.1", default-features = false, features = ["std"] }
objc2 = { version = "0.6.4", default-features = false, features = ["std"] }
objc2-app-kit = { version = "0.3.2", default-features = false, features = ["std", "NSApplication", "NSResponder"] }
muda = { version = "0.21.2", default-features = false, optional = true }
[lints]
workspace = true