macos: tab color is codable for restoration

pull/9784/head
Mitchell Hashimoto 2025-12-11 07:24:46 -08:00
parent 51589a4e02
commit 04913905a3
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 5 additions and 5 deletions

View File

@ -9,13 +9,13 @@ class TerminalRestorableState: Codable {
let focusedSurface: String?
let surfaceTree: SplitTree<Ghostty.SurfaceView>
let effectiveFullscreenMode: FullscreenMode?
let tabColorRawValue: Int
let tabColor: TerminalTabColor
init(from controller: TerminalController) {
self.focusedSurface = controller.focusedSurface?.id.uuidString
self.surfaceTree = controller.surfaceTree
self.effectiveFullscreenMode = controller.fullscreenStyle?.fullscreenMode
self.tabColorRawValue = controller.tabColor.rawValue
self.tabColor = controller.tabColor
}
init?(coder aDecoder: NSCoder) {
@ -33,7 +33,7 @@ class TerminalRestorableState: Codable {
self.surfaceTree = v.value.surfaceTree
self.focusedSurface = v.value.focusedSurface
self.effectiveFullscreenMode = v.value.effectiveFullscreenMode
self.tabColorRawValue = v.value.tabColorRawValue
self.tabColor = v.value.tabColor
}
func encode(with coder: NSCoder) {
@ -97,7 +97,7 @@ class TerminalWindowRestoration: NSObject, NSWindowRestoration {
return
}
c.tabColor = TerminalTabColor(rawValue: state.tabColorRawValue) ?? .none
c.tabColor = state.tabColor
// Setup our restored state on the controller
// Find the focused surface in surfaceTree

View File

@ -1,6 +1,6 @@
import AppKit
enum TerminalTabColor: Int, CaseIterable {
enum TerminalTabColor: Int, CaseIterable, Codable {
case none
case blue
case purple