ghostty/macos/Sources/Features/About/AboutView.swift
Mitchell Hashimoto 2e74a0f9d4 macos: custom about window so we can be a first responder
Fixes #1052

This implements the about window as a custom window with a view
controller. This lets us implement the proper responder chain so that
our custom close window IBActions do the right thing.

This has an additional benefit that we can easily customize this window
going forward.
2023-12-17 15:51:04 -08:00

31 lines
752 B
Swift

import SwiftUI
struct AboutView: View {
/// Read the commit from the bundle.
var commit: String {
guard let valueAny = Bundle.main.infoDictionary?["CFBundleVersion"],
let version = valueAny as? String else {
return "unknown"
}
return version
}
var body: some View {
VStack(alignment: .center) {
Image("AppIconImage")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(maxHeight: 96)
Text("Ghostty")
.font(.title3)
Text("Commit: \(commit)")
.font(.body)
}
.frame(minWidth: 300)
.padding()
}
}