mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-02 18:08:11 +00:00
These will be automatically synthesized (they only do memberwise initialization) and do not need to be manually defined.
32 lines
1.2 KiB
Swift
32 lines
1.2 KiB
Swift
import AppKit
|
|
|
|
extension TerminalRestorableState {
|
|
/// Internal State we use to perform unit tests
|
|
///
|
|
/// Since we can't really change the type of `TerminalRestorableState`
|
|
/// due to `CodableBridge<TerminalRestorableState>` supporting secure coding,
|
|
/// we use an internal type to perform migration and tests
|
|
struct InternalState<ViewType: NSView & Codable & Identifiable>: Codable {
|
|
// MARK: - Version 5 (1.2.3)
|
|
let focusedSurface: String?
|
|
let surfaceTree: SplitTree<ViewType>
|
|
|
|
// MARK: - Version 7 (1.3.0)
|
|
let effectiveFullscreenMode: FullscreenMode?
|
|
let tabColor: TerminalTabColor?
|
|
let titleOverride: String?
|
|
}
|
|
}
|
|
|
|
extension TerminalRestorableState.InternalState where ViewType == Ghostty.SurfaceView {
|
|
init(from controller: TerminalController) {
|
|
self.init(
|
|
focusedSurface: controller.focusedSurface?.id.uuidString,
|
|
surfaceTree: controller.surfaceTree,
|
|
effectiveFullscreenMode: controller.fullscreenStyle?.fullscreenMode,
|
|
tabColor: (controller.window as? TerminalWindow)?.tabColor,
|
|
titleOverride: controller.titleOverride,
|
|
)
|
|
}
|
|
}
|