From 790f3c8287f0a4bfa7375c6820f07279bbcd9d60 Mon Sep 17 00:00:00 2001 From: Lawrence Chen <54008264+lawrencecchen@users.noreply.github.com> Date: Mon, 23 Feb 2026 00:20:12 -0800 Subject: [PATCH] Ignore stale background payload in theme refresh --- Sources/WorkspaceContentView.swift | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Sources/WorkspaceContentView.swift b/Sources/WorkspaceContentView.swift index ebe6a414..1ab7655f 100644 --- a/Sources/WorkspaceContentView.swift +++ b/Sources/WorkspaceContentView.swift @@ -103,14 +103,13 @@ struct WorkspaceContentView: View { refreshGhosttyAppearanceConfig(reason: "colorSchemeChanged:\(oldValue)->\(newValue)") } .onReceive(NotificationCenter.default.publisher(for: .ghosttyDefaultBackgroundDidChange)) { notification in - if let backgroundColor = notification.userInfo?[GhosttyNotificationKey.backgroundColor] as? NSColor { - refreshGhosttyAppearanceConfig( - reason: "ghosttyDefaultBackgroundDidChange:withPayload", - backgroundOverride: backgroundColor - ) - } else { - refreshGhosttyAppearanceConfig(reason: "ghosttyDefaultBackgroundDidChange:withoutPayload") - } + let payloadHex = (notification.userInfo?[GhosttyNotificationKey.backgroundColor] as? NSColor)?.hexString() ?? "nil" + // Payload ordering can lag across rapid config/theme updates. + // Resolve from GhosttyApp.shared.defaultBackgroundColor to keep tabs aligned + // with Ghostty's current runtime theme. + refreshGhosttyAppearanceConfig( + reason: "ghosttyDefaultBackgroundDidChange:payload=\(payloadHex)" + ) } }